02.02.2011, 17:34
Olha ai cara fiz com base nesse seu cуdigo ._.
Estuda ele e vocк consegue:
Estuda ele e vocк consegue:
pawn Код:
#include <a_samp>
public OnPlayerCommandText(playerid, cmdtext[])
{
new tmp[128], string[128], cmd[128], idx;
cmd = strtok(cmdtext, idx);
new pNome[24];//Pega o nome do Admin
new iNome[24];//Pega o Nome do ID escolhido
GetPlayerName(playerid, pNome, sizeof(pNome));
if(strcmp(cmd, "/akill", true) == 0)
{
if(!IsPlayerAdmin(playerid))//Se vocк nгo for admin
{
SendClientMessage(playerid, 0x919191FF, "Vocк nгo й adminstrador!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))// Se voce errar o comando
{
SendClientMessage(playerid, 0x919191FF, "Uso: akill [ID]");
}
new id = strval(tmp);
if(!IsPlayerConnected(id))// Se o lek nгo estiver conectado
{
SendClientMessage(playerid, 0x919191FF, "Esse jogador nгo estб conectado!");
return 1;
}
GetPlayerName(id, iNome, sizeof(iNome));//Format GetplayerName que pega o Nome do ID
SetPlayerHealth(id, 0);//Seta a vida do ID para 0
format(string, sizeof(string), "O Admin %s setou sua vida para 0.", pNome);
SendClientMessage(id, 0xE21D2CFF, string);//Manda mensagem para o ID setado
format(string, sizeof(string), "Vocк setou a vida de %s para 0.", iNome);
SendClientMessage(playerid, 0xE21D2CFF, string);//Manda mensagem para o admin que usou o comando
return 1;
}
return 0;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index,result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}

