21.11.2011, 19:35
pawn Код:
if(!strcmp(cmd, "/car"))
{
new value[5], string[24 char];
if(unformat(params, "s[24]iI(-1)",string,value[0],value[1]))
return SendClientMessage(playerid, -1, "Uso: /car [veiculo] [cor 1] [cor 2]!");
value[3] = -1;
for(new i=0; i<sizeof(VehicleNames); i++)
{
if(strfind(VehicleNames[i], string, true) != -1)
{
value[3] = i+400;
break;
}
}
if(value[3] == -1) return SendClientMessage(playerid, COLOR_RED, "[Erro]{b4b5b7} Nome invбlido!");
GetPlayerPos(playerid, pX,pY,pZ);
GetPlayerFacingAngle(playerid, pA);
if(value[1] == -1) value[1] = value[0];
value[2] = CreateVehicle(value[3],pX,pY,pZ,pA,value[0],value[1],999999);
LinkVehicleToInterior(value[2], GetPlayerInterior(playerid));
SetVehicleVirtualWorld(value[2], GetPlayerVirtualWorld(playerid));
PutPlayerInVehicle(playerid, value[2], 0);
SendClientMessage(playerid, -1, "Veiculo criado com sucesso!");
return 1;
}