SA-MP Forums Archive
Vehicle help... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Vehicle help... (/showthread.php?tid=325610)



Vehicle help... - viddo - 13.03.2012

Alrighty, My dealership system requires that the player needs to enter one of the sales car of the dealership then he types /v buy then the same vehicle spawns at a certain place that i assigned, How can i make it that the player can do /v buy [Vehicleid] and it spawns instead of entering a sales car ?!


Ps: I got everything like the model id prices and spawn place and everything, I just want to know how to make that vehicle id spawning instead of created cars....


Re: Vehicle help... - ReneG - 13.03.2012

Like a player enters a car, types /v buy and the car they bought spawns at the entrance of the dealership and what not?

All you gotta do is get the coords of the place you want it, and use CreateVehicle. Then, once they buy it use RemovePlayerFromVehicle.


Re: Vehicle help... - viddo - 14.03.2012

Dude, I already got the way that they enter a vehicle, let's say the player enters a turismo and types /v buy the vehicle will spawn at the entrance of the dealer, Well i don't want the player to enter a turismo, I want him to type /v buy [Vehicleid] like if he types /v buy 420 He gets a taxi spawned instead of entering the dealership taxi and buys it....


Re: Vehicle help... - ReneG - 14.03.2012

This could be done via a command dude.
pawn Код:
CMD:v(playerid,params[])
{
    new vehicle,choice[24];
    if(sscanf(params,"s[24]d",choice,vehicle))
    {
        return SendClientMessage(playerid,-1,"USAGE: /v buy [vehicleid]");
    }
    if(!strcmp(choice,"buy",true)) // If they typed buy after /v
    {
        if(vehicleid == INVALID_VEHICLE_ID) // If the vehicle doesn't exist.
        {
            return SendClientMessage(playerid,-1,"ERROR: Invalid vehicle id");
        }
        else
        {
            CreateVehicle(vehicle/* rest of params go here*/);
            // You would then do all your ownership code here
            return 1;
        }
    }
    // You could add more /v options by doing this
    if(!strcmp(choice,"sell",true))
    {
        //code here
        return 1;
    }
    return 1;
}
Is this that what you were looking for?


Re: Vehicle help... - viddo - 14.03.2012

Thanks + rep for u


EDIT: undefined symbol : Vehicle id