03.09.2016, 09:32
PHP код:
if(strcmp(cmd, "/lchat", true) == 0 || strcmp(cmd, "/limparchat", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 3)
{
SendClientMessage(playerid, COLOR_GREY, "Vocк nгo й um admin!");
return true;
}
tmp = strrest(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /limparchat [motivo]");
return true;
}
if(admtrampando[playerid] < 1 && PlayerInfo[playerid][pAdmin] != DONO)
{
SendClientMessage(playerid, COLOR_GRAD1, " Vocк nгo estб em modo Admin USE: /jogar");
return true;
}
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) ClearChatbox(i, 100);
}
format(string, sizeof(string), "O admin %s limpou o chat, motivo: %s", PlayerName(playerid), tmp);
SendClientMessageToAll(COLOR_WHITE, string);
}
return true;
}
Primeiro vocк compila, se der erro do tipo: error 017: undefined symbol "strrest", ai vocк adiciona ela no final de seu gamemode!
PHP код:
stock strrest(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[128];
while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}