23/01/2023 15:54
Código PHP:
stock GetVehicleModelByName(const name[])
{
if(IsNumeric(name) && (strval(name) >= 400 && strval(name) <= 611))
return strval(name);
for(new i = 0; i < sizeof(g_arrVehicleNames); i ++)
{
if (strfind(g_arrVehicleNames[i], name, true) != -1)
{
return i + 400;
}
}
return 0;
}
stock IsNumeric(const str[])
{
for (new i = 0, l = strlen(str); i != l; i ++)
{
if (i == 0 && str[0] == '-')
continue;
else if (str[i] < '0' || str[i] > '9')
return 0;
}
return 1;
}
Código PHP:
CMD:car(playerid, params[])
{
static
model[32],
color1,
color2;
if(sscanf(params, "s[25]dd", model, color1, color2))
return SendClientMessage(playerid, -1, "* /car [modelo id/nome] [cor 1(opcional)] [cor 2(opcional)]");
if((model[0] = GetVehicleModelByName(model)) == 0)
return SendClientMessage(playerid, -1, "* ID de modelo inválido.");
static
Float:x, Float:y, Float:z, Float:a, vehicle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
vehicle = CreateVehicle(model[0], x, y, z, a, color1, color2, 0);
PutPlayerInVehicle(playerid, vehicle, 0);
return 1;
}
o carro só e spawnado quando estou no virtual world 0 alguem sabe resolver??