21.08.2012, 11:57
the problem is the following:
when i type example.. /v vehiclenotfound281
not send the message "Name not found"
but spawn the vehicle... last spawned
code:
when i type example.. /v vehiclenotfound281
not send the message "Name not found"
but spawn the vehicle... last spawned
code:
pawn Код:
if(isnull(params)) return SendClientMessage(playerid, -1, "use /v vehicle or id");
sscanf(params, "s[24]", temp_str);
if(IsNumeric(temp_str))
{
temp_id = strval(temp_str) - 400;
}
else
{
for(new i; i < sizeof(vehicle_list); i++)
{
if(strfind(vehicle_list[i], temp_str, true) != -1)
{
temp_id = i;
break;
}
}
}
if(temp_id < 0 || temp_id > 211) return SendClientMessage(playerid, -1, "Name not found");
SendClientMessage(playerid, -1, "vehicle spawned!");
GetPlayerPos(playerid, stat[0], stat[1], stat[2]), GetPlayerFacingAngle(playerid, stat[3]);
DestroyVehicle(user_vehicle[playerid]);
if(color[0] == -1) color[0] = random(125);
if(color[1] == -1) color[1] = random(125);
user_vehicle[playerid] = CreateVehicle(temp_id + 400, stat[0], stat[1], stat[2], stat[3], color[0], color[1], -1);
PutPlayerInVehicle(playerid, user_vehicle[playerid], 0);