Vehicle Team Check doesn't work properply
#1

Hello guys. i got a team check which player enter's vehicle but everytime i enter a vehicle. nothing happens even i'm in right team. no message shown, even if i'm CIVILIAN i can get into it and it doesn't kick me from the vehicle

Code
pawn Код:
//Array
new PoliceVehicles[] =
{
    427,
    497,
    596
};
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new string[128];
   
    //anti-driveby
    if(newstate == PLAYER_STATE_DRIVER)
    {
        SetPlayerArmedWeapon(playerid, 0);
    }
    if (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        new str[128];
        //Speed KM/H
        new Float:s = GetPlayerSpeed(playerid);
        new ss = floatround(s);
        format(str, sizeof(str), "~w~Speed: ~g~%d km/h", ss);
        TextDrawSetString(speedo[0][playerid], str);
        TextDrawShowForPlayer(playerid, speedo[0][playerid]);
        //Gas
        new vid = GetPlayerVehicleID(playerid);
        format(str, sizeof(str), "~w~Gasoline: ~%s~%d \%", FuelColor(vid), CarFuel[vid]);
        TextDrawSetString(speedo[1][playerid], str);
        TextDrawShowForPlayer(playerid, speedo[1][playerid]);
        //for rape! and detain
        LastVehicle[playerid] =GetPlayerVehicleID(playerid);
    }

    if(newstate == PLAYER_STATE_ONFOOT)
    {
        //Driveby
        SetPlayerArmedWeapon(playerid, 1);
        //
        TextDrawHideForPlayer(playerid, speedo[0][playerid]);
        TextDrawHideForPlayer(playerid, speedo[1][playerid]);
    }

    if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
    {
        if(CIAIsBeingWatched[playerid] == 1)
        {
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                if(CIAPlayerBeingViewed[i] == playerid)
                {
                    new pveh =GetPlayerVehicleID(playerid);
                    PlayerSpectateVehicle(i,pveh);
                }
            }
        }
        if(IsBeingSpectated[playerid] == 1)
        {
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                if(SpectatingPlayer[i] == playerid)
                {
                    new pveh =GetPlayerVehicleID(playerid);
                    PlayerSpectateVehicle(i,pveh);
                }
            }
        }
    }

    if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)
    {
        if(CIAIsBeingWatched[playerid] == 1)
        {
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                if(CIAPlayerBeingViewed[i] == playerid)
                {
                    PlayerSpectatePlayer(i,playerid);
                }
            }
        }
        if(IsBeingSpectated[playerid] == 1)
        {
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                if(SpectatingPlayer[i] == playerid)
                {
                    PlayerSpectatePlayer(i,playerid);
                }
            }
        }
    }

    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 518  || GetVehicleModel(GetPlayerVehicleID(playerid)) == 482 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 475)
        {
            if(gTeam[playerid] == TEAM_CARJACKER)
            {
                GameTextForPlayer(playerid, "You can sell this~n~Vehicle at Crane",5000,3);
                new veh = GetPlayerVehicleID(playerid);
                CanBeSellOnCrane[veh] =1;
                return 1;
            }
        }
        return 1;
    }
   
    if(newstate == PLAYER_STATE_DRIVER)//CIA Vehicle
    {
        for(new i = 0; i < sizeof(CIAVeh); i++)
        {
            if(GetPlayerVehicleID(playerid) == CIAVeh[i] && gTeam[playerid] == TEAM_CIA) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");
            SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only CIA Personnel can use this car");
            RemovePlayerFromVehicle(playerid);
        }
        return 1;
    }

    if(newstate == PLAYER_STATE_DRIVER)//Police Vehicle
    {
        for(new i = 0; i < sizeof(PoliceVehicles); i++)
        {
            if(GetVehicleModel(GetPlayerVehicleID(playerid)) == PoliceVehicles[i]) //Your checking models here so thats correct
            {
                if(gTeam[playerid] == TEAM_POLICE || gTeam[playerid] == TEAM_ARMY || gTeam[playerid] == TEAM_CIA || gTeam[playerid] == TEAM_MEDIC) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");
               
                new current_zone;
                current_zone = player_zone[playerid]; // What is this suppost to do? to check player's location
                SendClientMessage(playerid,COLOR_GREY,"Law Enforcement Vehicle Theft");
                SendClientMessage(playerid,COLOR_RED,"You have stolen a Law Enforcement Vehicle. The police has been informed, watch out ..");
                IncreaseWantedLevel(playerid,4);

                format(string,sizeof(string),"[VEHICLE THEFT] Suspect %s(%d) has stolen a Law Enforcement Vehicle. Location: %s",PlayerName(playerid),playerid,zones[current_zone][zone_name]);
                return SendClientMessageToAllCops(string);
            }
        }
        return 1;
    }

    if(newstate == PLAYER_STATE_DRIVER)//Army Vehicle
    {
        for(new i = 0; i < sizeof(ArmyVeh); i++)
        {
            if(GetPlayerVehicleID(playerid) == ArmyVeh[i])
            {
                if(gTeam[playerid] == TEAM_ARMY) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");
                SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only Army Personnel can use the Army vehicles.");
                RemovePlayerFromVehicle(playerid);
            }
        }
        return 1;
    }

    if(newstate == PLAYER_STATE_DRIVER)//FBI And Swat Vehicle
    {
        for(new i = 0; i < sizeof(FBISwat); i++)
        {
            if(GetPlayerVehicleID(playerid) == FBISwat[i])
            {
                if(GetPlayerSkin(playerid) == 286 || (GetPlayerSkin(playerid) == 285)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");
                SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only FBI and SWAT Personnel can use the this vehicles.");
                RemovePlayerFromVehicle(playerid);
            }
        }
        return 1;
    }

    if(newstate == PLAYER_STATE_DRIVER)//Ambulance vehicle
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 416) //This one is correct as your comparing a model
        {
            if(gTeam[playerid] == TEAM_POLICE && gTeam[playerid] == TEAM_ARMY && gTeam[playerid] == TEAM_CIA && gTeam[playerid] == TEAM_MEDIC) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");

            new current_zone;
            current_zone = player_zone[playerid];
            SendClientMessage(playerid,COLOR_GREY,"Ambulance Vehicle Theft");
            SendClientMessage(playerid,COLOR_RED,"You have stolen an Ambulance. The police has been informed, watch out ..");
            IncreaseWantedLevel(playerid,4);

            format(string,sizeof(string),"[VEHICLE THEFT] Suspect %s(%d) has stolen a Amubalance. Location: %s",PlayerName(playerid),playerid,zones[current_zone][zone_name]);
            SendClientMessageToAllCops(string);
        }
        return 1;
    }

    new vid, Name[24], Msg[128], engine, lights, alarm, doors, bonnet, boot, objective;
    if (newstate == PLAYER_STATE_DRIVER)
    {
        vid = GetPlayerVehicleID(playerid);
        GetPlayerName(playerid, Name, sizeof(Name));
        if (AVehicleData[vid][Owned] == true)
        {
            if (strcmp(AVehicleData[vid][Owner], Name, false) != 0)
            {
                RemovePlayerFromVehicle(playerid);
                GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(vid, 0, 0, alarm, doors, bonnet, boot, objective);
                format(Msg, 128, ""red"[ERROR] "white"You cannot use this vehicle, it's owned by \"{FFFF00}%s{FF0000}\"", AVehicleData[vid][Owner]);
                SendClientMessage(playerid, 0xFFFFFFFF, Msg);
            }
        }
        return 1;
    }
    //
    return 1;
}
Reply
#2

Anyone.
about waiting almost an hour and i still got no any replies or help.
i hope someone could help me. thank you
Reply
#3

Okay just out of curiousity is your code being called? Can you place a print("ITS RUNNING OMFG!"); after all RemovePlayerFromVehicle occurances.

Then run the server hop in and tell me what it does in the Server Console.

I also recommend you use loops, you have added me on Skype so I can help you with them if needed.
Reply
#4

Where is the else clause?

Yours:

pawn Код:
if(gTeam[playerid] != TEAM_CIA)
{
    SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only CIA Personnel can use this car");
    RemovePlayerFromVehicle(playerid);                
    return 1;
}
 SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to your CIA Personnel vehicle.");
return 1;
Try this :

pawn Код:
if(gTeam[playerid] != TEAM_CIA)
{
    SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only CIA Personnel can use this car");
    RemovePlayerFromVehicle(playerid);                
    return 1;
}
else
{
 SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to your CIA Personnel vehicle.");
return 1;
}
Reply
#5

Quote:
Originally Posted by [CG]Milito
Посмотреть сообщение
Where is the else clause?

Yours:

pawn Код:
if(gTeam[playerid] != TEAM_CIA)
{
    SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only CIA Personnel can use this car");
    RemovePlayerFromVehicle(playerid);                
    return 1;
}
 SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to your CIA Personnel vehicle.");
return 1;
Try this :

pawn Код:
if(gTeam[playerid] != TEAM_CIA)
{
    SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only CIA Personnel can use this car");
    RemovePlayerFromVehicle(playerid);                
    return 1;
}
else
{
 SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to your CIA Personnel vehicle.");
return 1;
}
Nothing changes still same problem

BUMP!
Reply
#6

Quote:
Originally Posted by IceCube!
Посмотреть сообщение
Okay just out of curiousity is your code being called? Can you place a print("ITS RUNNING OMFG!"); after all RemovePlayerFromVehicle occurances.

Then run the server hop in and tell me what it does in the Server Console.
Did you try what he said?
Reply
#7

Quote:
Originally Posted by SilverKiller
Посмотреть сообщение
Did you try what he said?
yes i did try priting it 'DEBUGGING' but it doesn't work. nothing shown on my console.
Reply
#8

Okay well, I'm going to fix your problem but ALSO make it more readable and efficent, with a loop. You can read about loops here:

https://sampwiki.blast.hk/wiki/Loops

For player loops you should use Foreach as well thasts base standerd.

The problem was however you were missing a bracket under
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)//Ambulance vehicle
. Or I just removed it once rewriting it.

You also used AND && Insead of OR ||

pawn Код:
if(gTeam[playerid] != TEAM_POLICE || gTeam[playerid] != TEAM_ARMY && gTeam[playerid] != TEAM_CIA && gTeam[playerid] != TEAM_MEDIC)
Another problem as we talked about on skype was you compareding models to Vehicles IDs.

I've rewritten it though:

pawn Код:
new PoliceVehicles[]
{
    427, 497, 596, 523
};

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)//CIA Vehicle
    {
        for(new i = 0; sizeof(CIAVeh); i++)
        {
            if(GetPlayerVehicleID(playerid) == CIAVeh[i] && gTeam[playerid] == TEAM_CIA) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");
            SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only CIA Personnel can use this car");
            return RemovePlayerFromVehicle(playerid);
        }
    }

    if(newstate == PLAYER_STATE_DRIVER)//Police Vehicle
    {
        for(new i = 0; sizeof(PoliceVehicles); i++)
        {
            if(GetVehicleModel(GetPlayerVehicleID(playerid)) == PoliceVehicles[i]) //Your checking models here so thats correct
            {
                if(gTeam[playerid] == TEAM_POLICE || gTeam[playerid] == TEAM_ARMY || gTeam[playerid] == TEAM_CIA || gTeam[playerid] == TEAM_MEDIC) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");

                new current_zone;
                current_zone = player_zone[playerid]; // What is this suppost to do?
                SendClientMessage(playerid,COLOR_GREY,"Law Enforcement Vehicle Theft");
                SendClientMessage(playerid,COLOR_RED,"You have stolen a Law Enforcement Vehicle. The police has been informed, watch out ..");
                IncreaseWantedLevel(playerid,4);

                format(string,sizeof(string),"[VEHICLE THEFT] Suspect %s(%d) has stolen a Law Enforcement Vehicle. Location: %s",PlayerName(playerid),playerid,zones[current_zone][zone_name]);
                return SendClientMessageToAllCops(string);
            }
        }
    }

    if(newstate == PLAYER_STATE_DRIVER)//Army Vehicle
    {
        for(new i = 0; i < sizeof(ArmyVeh); i++)
        {
            if(GetPlayerVehicleID(playerid) == ArmyVeh[i])  return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");

            if(gTeam[playerid] == TEAM_ARMY) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");
            SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only Army Personnel can use the Army vehicles.");
            return RemovePlayerFromVehicle(playerid);
        }
    }

    if(newstate == PLAYER_STATE_DRIVER)//FBI And Swat Vehicle
    {
        for(new i = 0; i < sizeof(FBISwat); i++)
        {
            if(GetPlayerVehicleID(playerid) == FBISwat[i])
            {
                if(GetPlayerSkin(playerid) == 286 || (GetPlayerSkin(playerid) == 285)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");
                SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only FBI and SWAT Personnel can use the this vehicles.");
                RemovePlayerFromVehicle(playerid);
            }
        }
    }

    if(newstate == PLAYER_STATE_DRIVER)//Ambulance vehicle
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 416) //This one is correct as your comparing a model
        {
            if(gTeam[playerid] == TEAM_POLICE && gTeam[playerid] == TEAM_ARMY && gTeam[playerid] == TEAM_CIA && gTeam[playerid] == TEAM_MEDIC) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");
           
            new current_zone;
            current_zone = player_zone[playerid];
            SendClientMessage(playerid,COLOR_GREY,"Ambulance Vehicle Theft");
            SendClientMessage(playerid,COLOR_RED,"You have stolen an Ambulance. The police has been informed, watch out ..");
            IncreaseWantedLevel(playerid,4);

            format(string,sizeof(string),"[VEHICLE THEFT] Suspect %s(%d) has stolen a Amubalance. Location: %s",PlayerName(playerid),playerid,zones[current_zone][zone_name]);
            SendClientMessageToAllCops(string);
        }
    }
    return 1;
}
The code above is untested but rewritten as I couldn't read it in the [pawn] brackets. If it works cool. If it doesn't tell me //











Quote:
Originally Posted by [CG]Milito
Посмотреть сообщение
Where is the else clause?

Yours:

pawn Код:
if(gTeam[playerid] != TEAM_CIA)
{
    SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only CIA Personnel can use this car");
    RemovePlayerFromVehicle(playerid);                
    return 1;
}
 SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to your CIA Personnel vehicle.");
return 1;
Try this :

pawn Код:
if(gTeam[playerid] != TEAM_CIA)
{
    SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only CIA Personnel can use this car");
    RemovePlayerFromVehicle(playerid);                
    return 1;
}
else
{
 SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to your CIA Personnel vehicle.");
return 1;
}
I derepped you for this for two reasons, a you changed nothing but return locations, b that wasn;t the problem area.
Reply
#9

BUMP?

Anyone? everything works on OnPlayerStateChange except those Law Enforcement Vehicle's can anyone help me please? im having this problem for almost 2 days. hope somene could help me. i tried IceCube code's still nothing. its the same. anyone could help me?

i've also updated the code to the latest one!
Reply
#10

Like TEAM_CIA has been done. Do for all other vehicles also. Add a check for the player to check the correct team and you're done.

pawn Код:
//Array
new PoliceVehicles[] =
{
    427,
    497,
    596
};
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new string[128];

    //anti-driveby
    if(newstate == PLAYER_STATE_DRIVER)
    {
        SetPlayerArmedWeapon(playerid, 0);
    }
    if (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        new str[128];
        //Speed KM/H
        new Float:s = GetPlayerSpeed(playerid);
        new ss = floatround(s);
        format(str, sizeof(str), "~w~Speed: ~g~%d km/h", ss);
        TextDrawSetString(speedo[0][playerid], str);
        TextDrawShowForPlayer(playerid, speedo[0][playerid]);
        //Gas
        new vid = GetPlayerVehicleID(playerid);
        format(str, sizeof(str), "~w~Gasoline: ~%s~%d \%", FuelColor(vid), CarFuel[vid]);
        TextDrawSetString(speedo[1][playerid], str);
        TextDrawShowForPlayer(playerid, speedo[1][playerid]);
        //for rape! and detain
        LastVehicle[playerid] =GetPlayerVehicleID(playerid);
    }

    if(newstate == PLAYER_STATE_ONFOOT)
    {
        //Driveby
        SetPlayerArmedWeapon(playerid, 1);
        //
        TextDrawHideForPlayer(playerid, speedo[0][playerid]);
        TextDrawHideForPlayer(playerid, speedo[1][playerid]);
    }

    if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
    {
        if(CIAIsBeingWatched[playerid] == 1)
        {
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                if(CIAPlayerBeingViewed[i] == playerid)
                {
                    new pveh =GetPlayerVehicleID(playerid);
                    PlayerSpectateVehicle(i,pveh);
                }
            }
        }
        if(IsBeingSpectated[playerid] == 1)
        {
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                if(SpectatingPlayer[i] == playerid)
                {
                    new pveh =GetPlayerVehicleID(playerid);
                    PlayerSpectateVehicle(i,pveh);
                }
            }
        }
    }

    if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)
    {
        if(CIAIsBeingWatched[playerid] == 1)
        {
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                if(CIAPlayerBeingViewed[i] == playerid)
                {
                    PlayerSpectatePlayer(i,playerid);
                }
            }
        }
        if(IsBeingSpectated[playerid] == 1)
        {
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                if(SpectatingPlayer[i] == playerid)
                {
                    PlayerSpectatePlayer(i,playerid);
                }
            }
        }
    }

    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 518  || GetVehicleModel(GetPlayerVehicleID(playerid)) == 482 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 475)
        {
            if(gTeam[playerid] == TEAM_CARJACKER)
            {
                GameTextForPlayer(playerid, "You can sell this~n~Vehicle at Crane",5000,3);
                new veh = GetPlayerVehicleID(playerid);
                CanBeSellOnCrane[veh] =1;
                return 1;
            }
        }
        return 1;
    }
    if(newstate == PLAYER_STATE_DRIVER)//CIA Vehicle
    {
        for(new i = 0; i < sizeof(CIAVeh); i++)
        {
            if(GetVehicleModel(GetPlayerVehicleID(playerid)) == CIAVeh[i] && gTeam[playerid] == TEAM_CIA) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");
            SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only CIA Personnel can use this car");
            RemovePlayerFromVehicle(playerid);
        }
        return 1;
    }

    if(newstate == PLAYER_STATE_DRIVER)//Army Vehicle
    {
        for(new i = 0; i < sizeof(ArmyVeh); i++)
        {
            if(GetVehicleModel(GetPlayerVehicleID(playerid)) == ArmyVeh[i])
            {
                if(gTeam[playerid] == TEAM_ARMY) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");
                SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only Army Personnel can use the Army vehicles.");
                RemovePlayerFromVehicle(playerid);
            }
        }
        return 1;
    }

    if(newstate == PLAYER_STATE_DRIVER)//FBI And Swat Vehicle
    {
        for(new i = 0; i < sizeof(FBISwat); i++)
        {
            if(GetVehicleModel(GetPlayerVehicleID(playerid)) == FBISwat[i])
            {
                if(GetPlayerSkin(playerid) == 286 || (GetPlayerSkin(playerid) == 285)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");
                SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only FBI and SWAT Personnel can use the this vehicles.");
                RemovePlayerFromVehicle(playerid);
            }
        }
        return 1;
    }
    if(newstate == PLAYER_STATE_DRIVER)//Police Vehicle
    {
        for(new i = 0; i < sizeof(PoliceVehicles); i++)
        {
            if(GetVehicleModel(GetPlayerVehicleID(playerid)) == PoliceVehicles[i]) //Your checking models here so thats correct
            {
                if(gTeam[playerid] == TEAM_POLICE || gTeam[playerid] == TEAM_ARMY || gTeam[playerid] == TEAM_CIA || gTeam[playerid] == TEAM_MEDIC) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");

                new current_zone;
                current_zone = player_zone[playerid]; // What is this suppost to do? to check player's location
                SendClientMessage(playerid,COLOR_GREY,"Law Enforcement Vehicle Theft");
                SendClientMessage(playerid,COLOR_RED,"You have stolen a Law Enforcement Vehicle. The police has been informed, watch out ..");
                IncreaseWantedLevel(playerid,4);

                format(string,sizeof(string),"[VEHICLE THEFT] Suspect %s(%d) has stolen a Law Enforcement Vehicle. Location: %s",PlayerName(playerid),playerid,zones[current_zone][zone_name]);
                return SendClientMessageToAllCops(string);
            }
        }
        return 1;
    }
    if(newstate == PLAYER_STATE_DRIVER)//Ambulance vehicle
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 416) //This one is correct as your comparing a model
        {
            if(gTeam[playerid] == TEAM_POLICE && gTeam[playerid] == TEAM_ARMY && gTeam[playerid] == TEAM_CIA && gTeam[playerid] == TEAM_MEDIC) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");

            new current_zone;
            current_zone = player_zone[playerid];
            SendClientMessage(playerid,COLOR_GREY,"Ambulance Vehicle Theft");
            SendClientMessage(playerid,COLOR_RED,"You have stolen an Ambulance. The police has been informed, watch out ..");
            IncreaseWantedLevel(playerid,4);

            format(string,sizeof(string),"[VEHICLE THEFT] Suspect %s(%d) has stolen a Amubalance. Location: %s",PlayerName(playerid),playerid,zones[current_zone][zone_name]);
            SendClientMessageToAllCops(string);
        }
        return 1;
    }

    new vid, Name[24], Msg[128], engine, lights, alarm, doors, bonnet, boot, objective;
    if (newstate == PLAYER_STATE_DRIVER)
    {
        vid = GetPlayerVehicleID(playerid);
        GetPlayerName(playerid, Name, sizeof(Name));
        if (AVehicleData[vid][Owned] == true)
        {
            if (strcmp(AVehicleData[vid][Owner], Name, false) != 0)
            {
                RemovePlayerFromVehicle(playerid);
                GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(vid, 0, 0, alarm, doors, bonnet, boot, objective);
                format(Msg, 128, ""red"[ERROR] "white"You cannot use this vehicle, it's owned by \"{FFFF00}%s{FF0000}\"", AVehicleData[vid][Owner]);
                SendClientMessage(playerid, 0xFFFFFFFF, Msg);
            }
        }
        return 1;
    }
    //
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)