SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 08/07/2014, 07:20 PM   #1
LivingLikeYouDo
Banned
 
Join Date: Jun 2014
Location: <4char>
Posts: 389
Reputation: 28
Default Removing player from hydra if GetPlayerScore(playerid) <- 1000

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!
LivingLikeYouDo is offline   Reply With Quote
Old 08/07/2014, 07:48 PM   #2
Affan
Huge Clucker
 
Affan's Avatar
 
Join Date: Dec 2012
Posts: 391
Reputation: 28
Default Re: Removing player from hydra if GetPlayerScore(playerid) <- 1000

pawn Code:
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;
}
Affan is offline   Reply With Quote
Old 08/07/2014, 07:52 PM   #3
RenovanZ
Gangsta
 
RenovanZ's Avatar
 
Join Date: Jul 2012
Location: Jogjakarta, Indonesia
Posts: 599
Reputation: 32
Default Re: Removing player from hydra if GetPlayerScore(playerid) <- 1000

EDIT: Too Late
pawn Code:
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;
}
__________________
__________________________________________________
My Work(s)
__________________________________________________

RenovanZ is offline   Reply With Quote
Old 08/07/2014, 08:02 PM   #4
LivingLikeYouDo
Banned
 
Join Date: Jun 2014
Location: <4char>
Posts: 389
Reputation: 28
Default Re: Removing player from hydra if GetPlayerScore(playerid) <- 1000

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!
LivingLikeYouDo is offline   Reply With Quote
Old 08/07/2014, 08:03 PM   #5
Threshold
High-roller
 
Threshold's Avatar
 
Join Date: Nov 2012
Location: Australia
Posts: 3,087
Reputation: 519
Default Re: Removing player from hydra if GetPlayerScore(playerid) <- 1000

OnPlayerEnterVehicle is called when a player BEGINS to enter a vehicle, not when he has actually entered it.

pawn Code:
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:
http://wiki.sa-mp.com/wiki/OnPlayerStateChange
http://wiki.sa-mp.com/wiki/RemovePlayerFromVehicle
http://wiki.sa-mp.com/wiki/GetPlayerScore
http://wiki.sa-mp.com/wiki/GetVehicleModel
http://wiki.sa-mp.com/wiki/GetPlayerVehicleID
__________________

Kar's Cops and Robbers 2019

Last edited by Threshold; 09/07/2014 at 03:21 AM.
Threshold is offline   Reply With Quote
Old 08/07/2014, 08:14 PM   #6
LivingLikeYouDo
Banned
 
Join Date: Jun 2014
Location: <4char>
Posts: 389
Reputation: 28
Default Re: Removing player from hydra if GetPlayerScore(playerid) <- 1000

@Threshold - Thank you very much
LivingLikeYouDo is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Increase max player limit beyond 1000? CremeDeLaMeme Server Support 3 25/02/2014 04:52 AM
Player cant enter a Tank or A Hydra California_ Scripting Help 3 12/02/2013 07:14 PM
Removing other player icons from the map and removing the yellow arrow. davelord Scripting Help 2 10/01/2012 04:07 PM


All times are GMT. The time now is 11:20 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.