15.12.2014, 14:03
Assim se nгo for desculpe-me
pawn Код:
public OnPlayerCommandText(playerid, cmd[])
{
new
cmd[128], idx, tmp[128];
cmd = strtok(cmd, idx);
GetPlayerPos(playerid, PlayerGetPos[0], PlayerGetPos[1], PlayerGetPos[2]);
new
Float:iAngulo
;
GetPlayerFacingAngle(playerid, iAngulo);
CMD:veh(playerid, params[]) return cmd_criarveiculo(playerid, params);
CMD:criarveiculo(playerid, params[])
{
tmp = strtok(cmd, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF3300AA, "| ERRO | Uso correto: /CriarVeiculo [Veнculo ID / Nome] [Cor 1] [Cor 2]");
return 1;
}
new veiculo = GetVehicleModelID(tmp);
if(veiculo == -1)
{
veiculo = strval(tmp);
if(veiculo < 400 || veiculo > 611)
{
SendClientMessage(playerid, 0xFF3300AA, "| ERRO | Uso correto: /CriarVeiculo [Veнculo ID / Nome] [Cor 1] [Cor 2]");
return 1;
}
}
tmp = strtok(cmd, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF3300AA, "| ERRO | Uso correto: /CriarVeiculo [Veнculo ID / Nome] [Cor 1] [Cor 2]");
return 1;
}
new color1 = strval(tmp);
tmp = strtok(cmd, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF3300AA, "| ERRO | Uso correto: /CriarVeiculo [Veнculo ID / Nome] [Cor 1] [Cor 2]");
return 1;
}
new color2 = strval(tmp);
if(veiculo < 400 || veiculo > 611)
{
SendClientMessage(playerid, 0xFF3300AA, "| ERRO | Somente veнculos entre 400 б 611!");
return 1;
}
DestroyVehicle(VeiculoID[playerid]);
PutPlayerInVehicle(playerid, Modelo[ playerid ] = CreateVehicle(veiculo, PlayerGetPos[0], PlayerGetPos[1], PlayerGetPos[2], iAngulo, color1, color2, -1), 0);
VeiculoID[playerid] = GetPlayerVehicleID(playerid);
CriouVeiculo[playerid] = true;
format(g_string, sizeof(g_string), "| INFO | %s criado com sucesso! (Somente vocк pode dirigi-lo)", Veiculos[GetVehicleModel(Modelo[ playerid ])-400]);
SendClientMessage(playerid, 0xFFFF33AA, g_string);
format(g_string, sizeof(g_string), "%s [%d]", PlayerName(playerid), playerid);
VLabel3D[playerid] = Create3DTextLabel(g_string, 0x00FF00AA, 0.0, 0.0, 0.0, 40.0, 0, 1);
Attach3DTextLabelToVehicle(VLabel3D[playerid], Modelo[ playerid ], 0.0, -2.5, 0.5);
format(Veiculopp[VeiculoID[playerid]][Nome], 20, PlayerName(playerid));
return 1;
}