SA-MP Forums Archive
[Help] Simple RemovePLlayerFromVehicule - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Simple RemovePLlayerFromVehicule (/showthread.php?tid=238285)



[Help] Simple RemovePLlayerFromVehicule - Sn4ke - 11.03.2011

Hello, I try to make a script where the player will be ejected from an hunter if he wasn't in the army group (lieutenant) that I previously set.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
        if(GetVehicleModel(vehicleid) == 425) {  
        if(Rank[playerid] = 4) { // (no problem here)
        {
        SendClientMessage(playerid,COLOR_GREEN,"Welcome To The Hunter!");
        }
        }
        else SendClientMessage(playerid,COLOR_RED,"You Are Not a lieutenant");
        GetPlayerVehicleID(playerid);                     //problem here
        RemovePlayerFromVehicle(playerid);    //problem here
    }
        return 1;
}
But when I enter in a vehicule it said just "You are not a military" and I'm not ejected from the vehicule (I'm not in the army group) PLease help thanks

Sorry 4 my bad English


Re: [Help] Simple RemovePLlayerFromVehicule - Sasino97 - 11.03.2011

Quote:
Originally Posted by Sn4ke
Посмотреть сообщение
Hello, I try to make a script where the player will be ejected from an hunter if he wasn't in the army group (lieutenant) that I previously set.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
        if(GetVehicleModel(vehicleid) == 425) {  
        if(Rank[playerid] = 4) { // (no problem here)
        {
        SendClientMessage(playerid,COLOR_GREEN,"Welcome To The Hunter!");
        }
        }
        else SendClientMessage(playerid,COLOR_RED,"You Are Not a lieutenant");
        GetPlayerVehicleID(playerid);                     //problem here
        RemovePlayerFromVehicle(playerid);    //problem here
    }
        return 1;
}
But when I enter in a vehicule it said just "You are not a military" and I'm not ejected from the vehicule (I'm not in the army group) PLease help thanks

Sorry 4 my bad English


1) Use ClearAnimations(playerid); It works fine.

2) Brackets

pawn Код:
else SendClientMessage(playerid,COLOR_RED,"You Are Not a lieutenant");
  GetPlayerVehicleID(playerid);                     //problem here
  RemovePlayerFromVehicle(playerid);    //problem here
with this you mean that:

else: Send the message

In every case: Get the vehicle and remove him.

The correct thing to do is:

else: Send the message, get the vehicle and remove the player.


INFO: ClearAnimation means that the player can't perform the Entering-vehicle animation

USE:

pawn Код:
else { SendClientMessage(playerid,COLOR_RED,"You Are Not a lieutenant");
    GetPlayerVehicleID(playerid);                     //problem here
    ClearAnimations(playerid);    //problem here
  }



Re : [Help] Simple RemovePLlayerFromVehicule - Sn4ke - 11.03.2011

thank you thank you thank you

it works perfectly, more better, he does not enter into the hunter


New post - Sasino97 - 11.03.2011

You're welcome =)


Re: [Help] Simple RemovePLlayerFromVehicule - dice7 - 11.03.2011

The reason why RemovePlayerFromVehicle() didn't work is because OnPlayerEnterVehicle gets called when a player presses the enter key. At that time he isn't actually inside the vehicle, just the animation starts playing