Problem with spawning a vehicle
#1

Hello there. I have tried creating my own /veh command and it appears to be working wrong. So I decided to copy a /veh command from another script and it didnt work in the same way. It successfully creates the vehicle, but the vehicle is invisible for me.

Here is the command I tried to create by myself.
pawn Код:
CMD:veh(playerid, params[])
{
    new car;
    new string[128];
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
    if(sscanf(params,"i", car)) return SendClientMessage(playerid,0xff0000ff,"USAGE: /Veh <Vehicle ID 400 - 611>");
    else if(car < 400 || car >611) return SendClientMessage(playerid, 0xff0000ff, "ERROR: Cannot go under 400 or above 611.");
    {
    if(Vehicle[playerid] != 0)
        {
            DestroyVehicle(Vehicle[playerid]);
        }
            Vehicle[playerid] = CreateVehicle(car, X, Y, Z + 2.0, 0, -1, -1, 1);
            format(string,sizeof(string),"You Have Spawned Vehicle ID %i",car);
            SendClientMessage(playerid, 0xffffffff, string);
            PutPlayerInVehicle(playerid, Vehicle[playerid], 0);
    }
    return 1;
}
pawn Код:
new Vehicle[MAX_PLAYERS];
================================================== ================================================== ========

Now, here is the second command that is not working as well, the same problem. Its spawning the vehicle but the vehicle is actually not spawned.

I used this: https://sampforum.blast.hk/showthread.php?tid=346727

================================================== ================================================== ========

I even tried with one more command. The same thing happened.
pawn Код:
CMD:veh(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 4)
    {
        new Vehicle[50];
        if(!sscanf(params, "s[50]", Vehicle))
        {
            new string[128], Float:Pos[4];
            GetPlayerPos(playerid, Pos[0],Pos[1],Pos[2]);
            GetPlayerFacingAngle(playerid, Pos[3]);
            new veh = GetVehicleModelID(Vehicle);
            if(veh < 400 || veh > 611) return SendClientMessage(playerid, GREY, "That wasn't a valid vehicle name.");
            if(!IsPlayerInAnyVehicle(playerid))
            {
                new vehicleid = CreateVehicle(veh, Pos[0], Pos[1], Pos[2], Pos[3], -1, -1, -1);
                PutPlayerInVehicle(playerid, vehicleid, 0);
                format(string, sizeof(string), "AdmCmd: %s has just spawned a %s (VID: %d)", RemoveUnderScore(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), GetPlayerVehicleID(playerid));
                SendAdminMessage(RED, string);
            }
            else return SendClientMessage(playerid, GREY, "You mustn't be in a vehicle to use this command.");
        }
        else return SendClientMessage(playerid, GREY, "Usage: /veh [vehiclename]");
    }
    else return SendClientMessage(playerid, GREY, AdminOnly);
    return 1;
}
At the end, none of the commands worked. The same happened to every of them. It says the vehicle has been spawned but the vehicle is not there.
Reply


Messages In This Thread
Problem with spawning a vehicle - by benjaminjones - 27.08.2015, 23:32
Re: Problem with spawning a vehicle - by bensmart469 - 27.08.2015, 23:52
Re: Problem with spawning a vehicle - by benjaminjones - 28.08.2015, 00:43
Re: Problem with spawning a vehicle - by benjaminjones - 28.08.2015, 14:43
Re: Problem with spawning a vehicle - by Logofero - 28.08.2015, 14:59
Re: Problem with spawning a vehicle - by Boot - 28.08.2015, 15:08
Re: Problem with spawning a vehicle - by benjaminjones - 28.08.2015, 17:32
Re: Problem with spawning a vehicle - by GuthiX - 28.08.2015, 18:10
Re: Problem with spawning a vehicle - by benjaminjones - 28.08.2015, 18:50

Forum Jump:


Users browsing this thread: 1 Guest(s)