first you need to create a function that spawns a car for you (this is the shortest way).
Add this in the end of your script:
pawn Код:
SpawnVehicle(playerid, vehicleid)
{
new Float:X, Float:Y, Float:Z, Float:A; //Stores your position and Angle
new Vehicle;
GetPlayerPos(playerid, X, Y, Z); //Gets your Position
GetPlayerFacingAngle(playerid, A); //Gets your Angle
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xF60000AA, "You have to be on foot to use this command!");
Vehicle = CreateVehicle(vehicleid, X, Y, Z, A, 1, 169, -1); //Creates vehicle
PutPlayerInVehicle(playerid, Vehicle, 0); //Puts you in the vehicle
return 1;
}
second thing we need to do is to create an command:
Add this under OnPlayerCommandText:
pawn Код:
if(strcmp("/nrg", cmdtext, true, 10) == 0)
{
SpawnVehicle(playerid, 522); //This creates an nrg and puts you in it.. ;D
SendClientMessage(playerid, 0xF60000AA, "Your brand new nrg successfully spawned. :D");
return 1;
}
you can create more cmds like this:
pawn Код:
if(strcmp("/infernus", cmdtext, true, 10) == 0)
{
SpawnVehicle(playerid, 411); //You just need to change the 411 to vehicle you want to spawn. in this case you will spawn infernus.
SendClientMessage(playerid, 0xF60000AA, "Your brand new infernus successfully spawned. :D");
return 1;
}
Edited a bit
hope this helped.
-Augis, Tik LT server`is..