Removing player from hydra if GetPlayerScore(playerid) <- 1000 - 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: Removing player from hydra if GetPlayerScore(playerid) <- 1000 (
/showthread.php?tid=524830)
Removing player from hydra if GetPlayerScore(playerid) <- 1000 -
LivingLikeYouDo - 08.07.2014
Hello mates!
So, I would want someone to give me a snippet or maybe explain me how to remove a player if his scores are less than 1000 from a hydra (if he enters it ofc!).
Any help would be appreciated!
Re: Removing player from hydra if GetPlayerScore(playerid) <- 1000 -
Affan - 08.07.2014
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetVehicleModel(vehicleid) == 520) // 520 is hydra
{
if(GetPlayerScore(playerid) < 1000)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0xFFFFFFFF, "You are not allowed to use hydra!");
}
}
return 1;
}
Re: Removing player from hydra if GetPlayerScore(playerid) <- 1000 -
RenovanZ - 08.07.2014
EDIT: Too Late
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetVehicleModel(vehicleid) == 520 && !ispassenger) //Check if the vehicle is Hydra and he's not passenger
{
if(GetPlayerScore(playerid) < 1000) //YOUR variable here, I dont know your variable, so I use this
{
RemovePlayerFromVehicle(playerid);
//send message or whatever
}
}
return 1;
}
Re: Removing player from hydra if GetPlayerScore(playerid) <- 1000 -
LivingLikeYouDo - 08.07.2014
Thank you both for your answers! And thank you RenovanZ for your explanation! I would like to ask for one more thing.
Could you please do it so like if a player have 1000 scores and IS a part of gTeam[playerid] == ARMY_PILOT then let him enter the hydra, else remove him
Thank you!
Re: Removing player from hydra if GetPlayerScore(playerid) <- 1000 -
Threshold - 08.07.2014
OnPlayerEnterVehicle is called when a player BEGINS to enter a vehicle, not when he has actually entered it.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate & PLAYER_STATE_DRIVER) //If the player entered as a driver
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 520) //If the vehicle is a hydra
{
if(GetPlayerScore(playerid) < 1000 || gTeam[playerid] != ARMY_PILOT) //If their score is less than 100
{
RemovePlayerFromVehicle(playerid); //Remove them from the vehicle
SendClientMessage(playerid, -1, "You must have 1000 score and be an army pilot to be able to use this vehicle.");
}
}
}
return 1;
}
Sources:
https://sampwiki.blast.hk/wiki/OnPlayerStateChange
https://sampwiki.blast.hk/wiki/RemovePlayerFromVehicle
https://sampwiki.blast.hk/wiki/GetPlayerScore
https://sampwiki.blast.hk/wiki/GetVehicleModel
https://sampwiki.blast.hk/wiki/GetPlayerVehicleID
Re: Removing player from hydra if GetPlayerScore(playerid) <- 1000 -
LivingLikeYouDo - 08.07.2014
@Threshold - Thank you very much