Kicking low score's from helicopters: Need help
#1

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if (GetPlayerVehicleID(playerid) == 497)
	{
	  if (GetPlayerScore(playerid) < 5 )
	  {
			RemovePlayerFromVehicle(playerid);
			GameTextForPlayer(playerid, "~r~Removed from Vehicle - Score not high enough",4000,5);
			SendClientMessage(playerid, COLOR_RED , "Kicked from vehicle - Score too low. Read /scoreinfo for help.");
		}
	}
	if (GetPlayerVehicleID(playerid) == 487)
	{
	  if (GetPlayerScore(playerid) < 5 )
	  {
			RemovePlayerFromVehicle(playerid);
			GameTextForPlayer(playerid, "~r~Removed from Vehicle - Score not high enough",4000,5);
			SendClientMessage(playerid, COLOR_RED , "Kicked from vehicle - Score too low. Read /scoreinfo for help.");
		}
	}
	if (GetPlayerVehicleID(playerid) == 563)
	{
	  if (GetPlayerScore(playerid) < 5 )
	  {
			RemovePlayerFromVehicle(playerid);
			GameTextForPlayer(playerid, "~r~Removed from Vehicle - Score not high enough",4000,5);
			SendClientMessage(playerid, COLOR_RED , "Kicked from vehicle - Score too low. Read /scoreinfo for help.");
		}
	}
	if (GetPlayerVehicleID(playerid) == 548)
	{
	  if (GetPlayerScore(playerid) < 5 )
	  {
			RemovePlayerFromVehicle(playerid);
			GameTextForPlayer(playerid, "~r~Removed from Vehicle - Score not high enough",4000,5);
			SendClientMessage(playerid, COLOR_RED , "Kicked from vehicle - Score too low. Read /scoreinfo for help.");
		}
	}


	return 1;
}
Doesn't seem to work. I'm quite not very good at this, so no wonder. Basicly, I want you to be kicked from helicopters when you enter them(the ID's are 548, 563, 487, 497) if your score is below 5.

Any ideas?(;
Reply
#2

Yes, i have one.
-Gimmi a sec and ill make it for you and explain it as good as i can
Reply
#3

Oh, I luv ya.

Btw your dialogue box tutorial was win!
Reply
#4

Hehe thank you

-Here, this will teach you how to do that thing

http://helipaste.pastebin.com/f7b1b7e28
UNTESTED
Reply
#5

You should use OnPlayerStateChange instead. As OnPlayerEnterVehicle is called when a player presses "ENTER". So you can't use RemovePlayerFromVehicle, becuase he's not sitting in the vehicle yet.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new veh = GetPlayerVehicleID(playerid);
        if(veh == 497 || veh == 487 || veh == 563 || veh == 548)
        {
            if(GetPlayerScore(playerid) < 5)
            {
                RemovePlayerFromVehicle(playerid);
                GameTextForPlayer(playerid, "~r~Removed from Vehicle - Score not high enough",4000,5);
                SendClientMessage(playerid, COLOR_RED , "Kicked from vehicle - Score too low. Read /scoreinfo for help.");
                return 1;
            }
        }
    }
    return 1;
}
Reply
#6

Oh Thanks man!

Almost perfect - but not quite.

Because it detecs he is in a vehicle the second I press "F" to enter, so it kicks me while entering, and then I don't get kicked.

So, is there any way to delay the RemovePlayerFromVehicle?
Reply
#7

Well, if you can give me some time ill make it with that function. im with my GF right now
Reply
#8

Ill test the state change one. Thanks guys, and np Niixie.
Reply
#9

|∞|-Рцппσĵσ-|∞|'s code is good. But I get the feeling that CrucixTM is actually trying to check the vehicle model not the vehicle id. So use this code if you wanted to do that.


pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehid = GetPlayerVehicleID(playerid);
new vehmodel = GetVehicleModel(vehid);
if(vehmodel == 497 || vehmodel == 487 || vehmodel == 563 || vehmodel == 548)
{
if(GetPlayerScore(playerid) < 5)
{
RemovePlayerFromVehicle(playerid);
GameTextForPlayer(playerid, "~r~Removed from Vehicle - Score not high enough",4000,5);
SendClientMessage(playerid, COLOR_RED , "Kicked from vehicle - Score too low. Read /scoreinfo for help.");
return 1;
}
}
}
return 1;
}
Reply
#10

Well I don't know what I want to check, if its Model or ID.

The list on sa-mp wiki said "Vehicle ID's" (I think) So I've been assuming the ID is the code for that type of vehicle, and the model had something to do with its appearance. Imma try yours, Celson.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)