pawn Код:
CMD:veh(playerid, params[])
{
if (isnull(params)) return SendClientMessage(playerid, COLOUR_RED, "Usage: /veh [name]");
new Model = GetVehicleModelIDFromName(params);
if (Model == -1) return SendClientMessage(playerid, COLOUR_RED, "You did not enter a valid vehicle name!");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
PutPlayerInVehicle(playerid, CreateVehicle(Model, x, y, z, 0.0, -1, -1, -1), 0);
return 1;
}
pawn Код:
GetVehicleModelIDFromName(vname[])
{
for(new i = 0; i < sizeof (vNames); i++)
{
if ( strfind(vNames[i], vname, true) != -1 )
return i + 400;
}
return -1;
}