The forums will be going offline for an extended maintenance period at 1400hrs GMT on 19th June 2025. The number of hours for this downtime is intentionally not advertised due to the nature of these upgrades.
×
- 0
HELP > adding "addrid(6)" on source code
-
Recently Browsing 0 members
- No registered users viewing this page.
Question
namerpus18
Good Day everyone,
I don't know if this script does make sense to you guys but I still hope you could help me achieve what I want to do here. What I am trying here is to attach all RIDs of players that are in the damagelog of the killedrid. I am not sure if I am on the right path. I've been learning source coding on different projects and got familiar with it but most of this code kinda strikes me with a lot of confusion about how it works so I can't solve it myself.
Thank you so much, guys.
BUILDIN_FUNC(addrid) { struct s_mapiterator* iter; struct block_list *bl; TBL_PC *sd; //IS THIS THE ATTACHED RID OF CHAR? ???? TBL_MOB* md = (TBL_MOB*)bl; //NEED TO ADD KILLEDRID DATE HERE???? if(st->rid < 1) { st->state = END; bl = map_id2bl(st->oid); } else bl = map_id2bl(st->rid); //if run without rid it'd error,also oid if npc, else rid for map iter = mapit_getallusers(); int type = script_getnum(st,2); bool forceflag = (script_hasdata(st,3) ? script_getnum(st,3) != 0 : 0); switch(type) { case 0: for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter)) { if(!forceflag || !sd->st) if(sd->status.account_id != st->rid) //attached player already runs. run_script(st->script,st->pos,sd->status.account_id,st->oid); } break; case 1: for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter)) { if(!forceflag || !sd->st) if((sd->bl.m == bl->m) && (sd->status.account_id != st->rid)) run_script(st->script,st->pos,sd->status.account_id,st->oid); } break; case 2: if(script_getnum(st,4) == 0) { script_pushint(st,0); mapit_free(iter); return SCRIPT_CMD_SUCCESS; } for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter)) { if(!forceflag || !sd->st) if((sd->status.account_id != st->rid) && (sd->status.party_id == script_getnum(st,4))) //attached player already runs. run_script(st->script,st->pos,sd->status.account_id,st->oid); } break; case 3: if(script_getnum(st,4) == 0) { script_pushint(st,0); mapit_free(iter); return SCRIPT_CMD_SUCCESS; } for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter)) { if(!forceflag || !sd->st) if((sd->status.account_id != st->rid) && (sd->status.guild_id == script_getnum(st,4))) //attached player already runs. run_script(st->script,st->pos,sd->status.account_id,st->oid); } break; case 4: map_foreachinallarea(buildin_addrid_sub, bl->m,script_getnum(st,4),script_getnum(st,5),script_getnum(st,6),script_getnum(st,7),BL_PC, st,forceflag);//4-x0 , 5-y0 , 6-x1, 7-y1 break; case 5: if (script_getstr(st, 4) == NULL) { script_pushint(st, 0); mapit_free(iter); return SCRIPT_CMD_FAILURE; } if (map_mapname2mapid(script_getstr(st, 4)) < 0) { script_pushint(st, 0); mapit_free(iter); return SCRIPT_CMD_FAILURE; } map_foreachinmap(buildin_addrid_sub, map_mapname2mapid(script_getstr(st, 4)), BL_PC, st, script_getnum(st, 3)); break; case 6: //ADDITION CODE ADD RID OF CHAR IDS IN DAMAGELOG OF THE KILLEDRID for (int i = 0; i < DAMAGELOG_SIZE; i++) { map_session_data* sd = map_charid2sd(md->dmglog[i].id); run_script(st->script, st->pos, sd->status.account_id, st->oid); } break; default: mapit_free(iter); if((map_id2sd(type)) == NULL) { // Player not found. script_pushint(st,0); return SCRIPT_CMD_SUCCESS; } if(!forceflag || !map_id2sd(type)->st) { run_script(st->script,st->pos,type,st->oid); script_pushint(st,1); } return SCRIPT_CMD_SUCCESS; } mapit_free(iter); script_pushint(st,1); return SCRIPT_CMD_SUCCESS; }
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.