pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
#define COR_VERMELHO 0xFF0000FF
#define COR_CINZA 0xAFAFAFAA
new tmp[256];
new cmd[256];
new string[256];
new CreatedCars[100];
new CreatedCar = 0;
new idx;
if(strcmp(cmd, "/veh", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COR_VERMELHO, " Autorizaзгo insuficiente !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COR_CINZA, "USO: /veh [carid] [color1] [color2]");
return 1;
}
new car;
car = strval(tmp);
if(car < 400 || car > 611) { SendClientMessage(playerid, COR_CINZA, " Vehicle Number can't be below 400 ou above 611 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COR_CINZA, "USO: /veh [carid] [color1] [color2]");
return 1;
}
new color1;
color1 = strval(tmp);
if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COR_CINZA, " Color Number can't be below 0 ou above 126 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COR_CINZA, "USO: /veh [carid] [color1] [color2]");
return 1;
}
new color2;
color2 = strval(tmp);
if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, COR_CINZA, " Color Number can't be below 0 ou above 126 !"); return 1; }
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
new carid = CreateVehicle(car, X+1,Y,Z, 0.0, color1, color2,60000);
CreatedCars[CreatedCar] = carid;
CreatedCar ++;
format(string, sizeof(string), "Veнculo criado.", carid);
SendClientMessage(playerid, COR_VERMELHO, string);
}
return 1;
}
if(strcmp(cmd, "/repararcarro", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COR_VERMELHO, " Autorizaзгo insuficiente !");
return 1;
}
if(IsPlayerInAnyVehicle(playerid))
{
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
SendClientMessage(playerid, COR_CINZA, " Veнculo Consertado !");
}
}
return 1;
}
if(strcmp(cmd, "/dvall", true) == 0) //Destroir todos carros q vc criou
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COR_VERMELHO, " Sem Autorizaзгo");
return 1;
}
for(new i = 0; i < sizeof(CreatedCars); i++)
{
if(i != 0)
{
DestroyVehicle(i);
}
}
SendClientMessage(playerid, COR_VERMELHO, " Veнculos Criados Destruidos !");
}
return 1;
}
return 1;
}
stock strtok(const string[], &index) //Fim GM
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Axo q nao era o q vc queria,mas por um lado bom,й sу vc add isso no teu gm,sem precisar ficar carregando Filterscripts.