#1

Hello,I need a /v command which spawns a nrg and after the player exits the nrg it gets destroyed +rep for the one who can provide me with this command.
Best regards,
Reply
#2

*bump*
Reply
#3

Even though this should be under scripting help, the code to do such thing should be:

pawn Код:
#include <a_samp>
#include <zcmd>

new PlayerVehicle[MAX_PLAYERS];

CMD:v(playerid, params[])
{
     new Float:x, Float:y, Float:z;
     GetPlayerPos(playerid, x, y, z);
     PlayerVehicle[playerid] = CreateVehicle(522, x, y, z, 0, 0, 0, -1);
     return 1;
}

public OnPlayerConnect(playerid)
{
     PlayerVehicle[playerid] = -1;
     return 1;  
}

public OnPlayerExitVehicle(playerid)
{
     DestroyVehicle(PlayerVehicle[playerid]);
     return 1;
}
Code not tested, however adjust it to your needs.
Reply
#4

doesn't
Код:
public OnPlayerExitVehicle(playerid)
{
     DestroyVehicle(PlayerVehicle[playerid]);
     return 1;
}
destroy server spawned vehicles or only vehicles spawned by the command?
Reply
#5

Quote:
PlayerVehicle[playerid] = CreateVehicle
DestroyVehicle(PlayerVehicle[playerid])

It declares the PlayerVehicle for the playerid that used the command as the vehicle created.
And then it destroys that vehicle, for the specific player.
So no it doesn't destroy all vehicles.
Reply
#6

ok thanks +rep for both
Reply
#7

One more question how do I make it spawn infront of me not ontop of me?
Reply
#8

Just plus the x or y coordinate by like 2 or 3
pawn Код:
CreateVehicle(522, x, y, z
To
pawn Код:
CreateVehicle(522, x + 3, y, z
Reply
#9

and if I would want it to put me automaticly in the vehicle what would I have to do I tried adding to the command
PutPlayerInVehicle(playerid, 522, 0);
but it still doesnt automaticly put me in the driver seat
Reply
#10

No, the vehicle was defined as PlayerVehicle[playerid]
So you have to PutPlayerInVehicle(playerid, PlayerVehicle[playerid], 0);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)