03.04.2009, 22:52
Ive this /warn code, but when i warn someone its doesnt show the reason i gave...
Why?
Why?
Код:
if(strcmp(cmd,"/warn",true)==0) { if(PlayerInfo[playerid][pAdmin] >= 2) tmp = strtok(cmdtext, idx); new otherplayer = ReturnUser(tmp); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]"); if(otherplayer == playerid) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't warn yourself !"); if(PlayerInfo[otherplayer][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't warn Admins!"); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]"); if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID."); new year, month, day; getdate(year, month, day); PlayerInfo[otherplayer][pWarns] ++; format(string, sizeof(string), "%s was warned by Administrator %s, Reason: (%s)", giveplayer, sendername, PlayerInfo[playerid][pWarns], (result)); SendClientMessageToAll(COLOR_RED, string); return 1; }