SA-MP Forums Archive
Kicking low score's from helicopters: Need help - 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)
+--- Thread: Kicking low score's from helicopters: Need help (/showthread.php?tid=123340)



Kicking low score's from helicopters: Need help - CrucixTM - 25.01.2010

Код:
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?(;


Re: Kicking low score's from helicopters: Need help - Niixie - 25.01.2010

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


Re: Kicking low score's from helicopters: Need help - CrucixTM - 25.01.2010

Oh, I luv ya.

Btw your dialogue box tutorial was win!


Re: Kicking low score's from helicopters: Need help - Niixie - 25.01.2010

Hehe thank you

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

http://helipaste.pastebin.com/f7b1b7e28
UNTESTED


Re: Kicking low score's from helicopters: Need help - Djiango - 25.01.2010

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;
}



Re: Kicking low score's from helicopters: Need help - CrucixTM - 25.01.2010

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?


Re: Kicking low score's from helicopters: Need help - Niixie - 25.01.2010

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


Re: Kicking low score's from helicopters: Need help - CrucixTM - 25.01.2010

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


Re: Kicking low score's from helicopters: Need help - Celson - 25.01.2010

|∞|-Рцппσĵσ-|∞|'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;
}



Re: Kicking low score's from helicopters: Need help - CrucixTM - 25.01.2010

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.