09.03.2013, 16:54
Hi, i've a problem with some sscanf CMD's, but I show you only a CMD.
Look:
This CMD is for warn players.
Problem: If i use this CMD with other players, warn goes to me. Example: I am ID 0, ok?
I want to warn ID 1.
I use: /warn 1 dfghbjnkmklnhjbg
I'm DanyelKing.
This is what that does: Admin DanyelKing has warned DanyelKing[reason: dfghbjnkmklnhjbg][1/3]
When I use /warn 0 abcdefg (my ID), it does the same thing.
Why?
Thanks for Help. Sorry for my Bad english, i'm Italian
Look:
Код:
dcmd_warn(playerid,params[]) { new idName[24]; new aName[24]; new idFile[300]; new aFile[300]; new string[256]; new id; new warn[256]; GetPlayerName(id,idName,sizeof(idName)); GetPlayerName(playerid,aName,sizeof(aName)); format(idFile,sizeof(idFile),PATH,idName); format(aFile,sizeof(aFile),PATH,aName); if(sscanf(params,"us",id,warn)) { if(dini_Int(aFile,"Admin") >= 3) { SendClientMessage(playerid,0xFF0000AA,"Usa: /warn <id/nome> <motivo> | /swarn <id/nome>"); } if(0 < dini_Int(aFile,"Admin") < 3) { SendClientMessage(playerid,0xFF0000AA,"Comando abilitato agli Admin da Liv.3 in poi."); } if(dini_Int(aFile,"Admin") == 0) { SendClientMessage(playerid,0xFF0000AA,"Comando abilitato agli Admin."); } return 1; } else { if(dini_Int(aFile,"Admin") >= 3) { if(id == INVALID_PLAYER_ID) { SendClientMessage(playerid,0xFF0000AA,"ID non connesso!"); } else if(!fexist(idFile)) { format(string,sizeof(string),"L'admin %s ha mandato un avvertimento a %s [Motivo: %s ]",aName,idName,warn); SendClientMessageToAll(COLOR_YELLOW,string); PlayerPlaySound(id,1149,0,0,0); } else { dini_IntSet(idFile,"Warn",dini_Int(idFile,"Warn")+1); format(string,sizeof(string),"L'admin %s ha mandato un avvertimento a %s [Motivo: %s ] [%d/3]",aName,idName,warn,dini_Int(idFile,"Warn")); SendClientMessageToAll(COLOR_YELLOW,string); format(string,sizeof(string),"[WARN] %s ha mandato un avvertimento a %s [Motivo: %s ] [%d/3]",aName,idName,warn,dini_Int(idFile,"Warn")); print(string); PlayerPlaySound(id,1149,0,0,0); if(dini_Int(idFile,"Warn") == 3) { format(string,sizeof(string),"{FF0000}%s и stato cacciato dal Server.[Motivo: 3 avvertimenti per ''%s'' ]",idName,warn); SendClientMessageToAll(COLOR_WHITE,string); format(string,sizeof(string),"[KICK] %s и stato cacciato.[Motivo: 3 avvertimenti per ''%s'' ]",idName,warn); print(string); Kick(id); } return 1; } return 1; } if(0 < dini_Int(aFile,"Admin") < 3) { SendClientMessage(playerid,0xFF0000AA,"Comando abilitato agli Admin da Liv.3 in poi."); } if(dini_Int(aFile,"Admin") == 0) { SendClientMessage(playerid,0xFF0000AA,"Comando abilitato agli Admin."); } } return 1; }
Problem: If i use this CMD with other players, warn goes to me. Example: I am ID 0, ok?
I want to warn ID 1.
I use: /warn 1 dfghbjnkmklnhjbg
I'm DanyelKing.
This is what that does: Admin DanyelKing has warned DanyelKing[reason: dfghbjnkmklnhjbg][1/3]
When I use /warn 0 abcdefg (my ID), it does the same thing.
Why?
Thanks for Help. Sorry for my Bad english, i'm Italian