26.08.2010, 15:21
Simples:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new tmp[128];
new cmd[128];
cmd = strtok(cmdtext, idx);// define a array 'cmd' que й cmdtext vocк nгo colocou!.
if(strcmp(cmd, "/carro", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, VERMELHO, "USO: /carro [ID] [COR 1] [COR 2]");
return 1;
}
new ID;
tmp = strtok(cmdtext, idx);
ID = strval(tmp);
new Cor1;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, VERMELHO, "USO: /carro [ID] [COR 1] [COR 2]");
return 1;
}
Cor1 = strval(tmp);
new Cor2;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, VERMELHO, "USO: /carro [ID] [COR 1] [COR 2]");
return 1;
}
Cor2 = strval(tmp);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
new Carro = CreateVehicle(ID, X, Y, Z, 0.0, Cor1, Cor2,60000);
AddVehicleComponent(Carro, 1079);
PutPlayerInVehicle(playerid, Carro,ID);
new string[22];
format(string, sizeof(string), "Veiculo ID:%d Criado", ID);
SendClientMessage(playerid, VERDE,string);
return 1;
}
if(strcmp(cmd, "/vida", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, VERMELHO, "USO: /vida [ID] [0 - 100]");
return 1;
}
new ID;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, VERMELHO, "USO: /vida [ID] [0 - 100]");
return 1;
}
ID = strval(tmp);
new Vida;
tmp = strtok(cmdtext, idx);
Vida = strval(tmp);
SetPlayerHealth(ID,Vida);
new string[44];
format(string, sizeof(string), "A Vida Do ID:%d Foi Setada Para %d", ID, Vida);
SendClientMessage(playerid, VERDE,string);
return 1;
}
return 0;
}