20.08.2012, 23:26
i have this code on my command.. and my question is.. how to spawn vehicle only with the name.. and not the id..
second question, how to add vehicles usable only for admins.. example hydra, rhino, hunter...
this is my code in the command
second question, how to add vehicles usable only for admins.. example hydra, rhino, hunter...
this is my code in the command
pawn Code:
if(isnull(params)) return SendClientMessage(playerid, -1, "use /v vehicled 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);