08.06.2012, 19:39
Can someone fix my command? when I use /v 425 or /v sultan or any vehicle ID or name, it just says HINT:/v, [Car name] then I do what it says and no vehicle spawns. Can someone fix my code please.
I Do not get any warnings or errors in the script.
pawn Код:
CMD:v(playerid, params[])
{
if(pGame[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You can not use this command whilst in a mini game!");
new String[200];
new tmp[32];
if(sscanf(params, "s[32]", tmp)) return SendClientMessage(playerid,COLOR_RED, "HINT /v [car name]");
new vehicle = GetVehicleModelIDFromName(tmp);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid,COLOR_RED, "That vehicle name you have given was not found, please try again!");
if(Veh[playerid][VehId] != -1)
DestroyVehicle(Veh[playerid][VehId]);
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
if(IsPlayerInAnyVehicle(playerid))
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
Veh[playerid][VehId] = PlayersVehicle;
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid,COLOR_ORANGE, String);
return 1;
}