27.08.2011, 11:38
PHP код:
if(strcmp(cmd, "/warn", true )== 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage( playerid, COLOR_GRAD2, " DEBUG: /hoiata <ID/NIMI> <Pohjus> ");
return 1;
}
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " VIGA: Sa ei ole sisse logitud. ");
return 1;
}
if(PlayerInfo[playerid][pAdmin] < 1);
{
SendClientMessage(playerid, COLOR_GREY, " VIGA: Ainult adminid voivad seda kasklust kasutada. ");
giveplayerid = ReturnUser(tmp);
}
if(IsPlayerConnected(giveplayerid))
{
if( giveplayerid != INVALID_PLAYER_ID )
{
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))
{
SendClientMessage( playerid, COLOR_GRAD2, " DEBUG: /hoiata <ID/NIMI> <Pohjus>");
return 1;
}
PlayerInfo[giveplayerid][pWarns] ++;
if(PlayerInfo[giveplayerid][pWarns] >= 5)
{
PlayerInfo[playerid][pLocked] = 2;
SendClientMessage(playerid, COLOR_LIGHTRED, "Sa said banni, sest sul taitusid 5 hoiatust.");
Ban(giveplayerid);
return 1;
}
format(string, sizeof(string), "Admin %s hoiatas sind. Pohjus: %s. ", sendername, result);
SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "Sa hoiatasid %s'i. Pohjus: %s.", giveplayer, result);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
return 1;
}
}
}
return 1;
}
}