#1

How to make that elegy get spawned when player selects from gui "drift" ?

here is my script:

pawn Код:
if(dialogid == 5)
{
if(response)
{
if(listitem == 0)
{
SetPlayerVirtualWorld(playerid, 2);
SetPlayerPos(playerid,-2421.2092,-610.8815,132.2896);
}
else if(listitem == 1)
{
SetPlayerHealth(playerid,0);
}
}
Reply
#2

Assuming that listitem 0 is the one you're talking about?

pawn Код:
if(dialogid == 5)
{
    if(response)
    {
        if(listitem == 0)
        {
            SetPlayerVirtualWorld(playerid, 2);
            new tmpVehicle = CreateVehicle(562,-2421.2092,-610.8815,132.2896,0.0,0,0,100);
            SetVehicleVirtualWorld(tmpVehicle,2);
            PutPlayerInVehicle(playerid, tmpVehicle, 0);
        }
        else if(listitem == 1)
        {
            SetPlayerHealth(playerid,0);
        }
    }
}
Reply
#3

ty, one more question, im making a command /leave, to leave from drift and i want that when player types it, that vehicle gets destroyed?
Reply
#4

DestroyVehicle(vehicleid);
Reply
#5

You can respawn the player if he/she writes /leave
pawn Код:
SpawnPlayer(playerid);
And it should be better if you respawn the vehicle instead of destoring:
pawn Код:
SetVehicleToRespawn(vehicleid);
Reply
#6

Well, I suggest you using a global variable for this case. This i assume is a Temporary Vehicle, created only for one player, So i don't think you should respawn it. Example of what i mean

pawn Код:
if(dialogid == 5)
{
if(response)
{
if(listitem == 0)
{
SetPlayerVirtualWorld(playerid, 2);
SetPlayerPos(playerid,-2421.2092,-610.8815,132.2896);
PlVeh[playerid] = CreateVehicle(562,-2421.2092,-610.8815,132.2896,0.0,0,0,100);
}
else if(listitem == 1)
{
SetPlayerHealth(playerid,0);
}
}
In the Leave command:

pawn Код:
DestroyVehicle(PlVeh[playerid]);
PlVeh[playerid] = 0; // Reseting The Variable
And on the top of your script
pawn Код:
new PlVeh[MAX_PLAYERS];
And What else we need is to reset that variable and remove the vehicle if the player leaves the server:

(OnPlayerDisconnect)

pawn Код:
DestroyVehicle(PlVeh[playerid]);
PlVeh[playerid] = 0;
Now, this is a bit of a Simpler, but slower and a way i Do not Suggest , Professionally i would use an if Statement to check if PlVeh[playerid] is a valid vehicle.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)