SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 09/11/2013, 08:54 PM   #1
Face9000
Banned
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,351
Reputation: 190
Default Just for green team

Ok so, i have a custom vehicle and i want to disable the use for TEAM_BLUE, so i did in this way:

pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
        new vehicleidk;
        vehicleidk = GetPlayerVehicleID(playerid);
        if(vehicleidk == Sultan)
        {
            if(gTeam[playerid] == TEAM_BLUE)
            {
            SendClientMessage(playerid,0xAA3333AA,"** Team blue can't steal the Sultan. Protect it!");
            RemovePlayerFromVehicle(playerid);
            return 0;
            }
        }
        return 1;
}

I have 2 teams: BLUE and GREEN. ONLY green should be allowed to take the Sultan, but doesn't work. Blue are allowed, how to fix it?
Face9000 is offline   Reply With Quote
Old 09/11/2013, 08:58 PM   #2
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,828
Reputation: 1401
Default Re: Just for green team

Quote:
This callback is called when a player starts to enter a vehicle, meaning the player is not in vehicle yet at the time this callback is called.
They're NOT IN the vehicle when it will be called; therebefore vehicleidk will be 0 and it cannot remove the player when they're not actually in the vehicle.

Use OnPlayerStateChange instead.

pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetPlayerVehicleID(playerid) == Sultan && gTeam[playerid] == TEAM_BLUE)
        {
            SendClientMessage(playerid,0xAA3333AA,"** Team blue can't steal the Sultan. Protect it!");
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}

I assume "Sultan" is vehicleid and not modelid.
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 09/11/2013, 09:00 PM   #3
Face9000
Banned
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,351
Reputation: 190
Default Re: Just for green team

Oh, thanks.
Face9000 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
[Map] TDM MAP Green vs red Anak Maps 17 17/03/2013 03:21 AM
[Map] Green Island S4n_n1 Maps 11 23/07/2012 06:51 AM
Color green = blue and green? knackworst Scripting Help 8 31/08/2011 03:21 PM
All teams are green!!!!!!!! samtey Help Archive 20 13/08/2011 11:54 AM
Green screen DaneAMattie Help Archive 5 22/02/2011 08:55 PM


All times are GMT. The time now is 04:30 PM.


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