04.04.2009, 00:10
Here mate.
Ive this /warn code, but when im warn someone else its shows me that i warned my self.
/warn 1 Test:
=
Taz86 was warned by admin taz86 reason: bla bla bla
Why?
I want it to show the name it was warned...
Ive this /warn code, but when im warn someone else its shows me that i warned my self.
/warn 1 Test:
=
Taz86 was warned by admin taz86 reason: bla bla bla
Why?
I want it to show the name it was warned...
Код:
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,result);
SendClientMessageToAll(COLOR_RED, string);
return 1;
}

