If team does not equal ... -
K9Alex - 25.06.2013
Hello,
Here's my problem, i'm trying to make a vehicle lock system but i'm stuck here;
Код:
if(gteam[playerid] != Team_Fire)
{
SendClientMessage(playerid, COLOR_YELLOW, "(INFO) You are not authorised to use that vehicle.");
RemovePlayerFromVehicle(playerid);
}
It works, however even when I am in the correct "team" it kicks me out of the vehicle, what am I doing wrong ?
Thank you,
K9Alex
Re: If team does not equal ... -
Vince - 25.06.2013
Debug, debug, debug. If something doesn't work then you add prints all over the place so you know what a variable holds at every point in code.
pawn Код:
if(gteam[playerid] != Team_Fire)
{
printf("DEBUG: gteam[%d] = %d, Team_Fire = %d", playerid, gteam[playerid], Team_Fire);
SendClientMessage(playerid, COLOR_YELLOW, "(INFO) You are not authorised to use that vehicle.");
RemovePlayerFromVehicle(playerid);
}
Re: If team does not equal ... -
K9Alex - 25.06.2013
Alright I tried that and that's the outpout;
Without being in the Team_GOV;
Код:
[05:54:44] DEBUG: gteam[0] = 12, Team_GOV = 17
12 being my Team_Civ (The default team when you spawn)
Now, I tried again being a Team_Gov member;
It kicks me out of the vehicle BUT doesn't show the "You are not authorised to use that vehicle." message.
The console doesn't show nothing (the printf doesn't show up)
I forgot a part of the "code" later, here's the full code for one team
That's added in "OnPlayerStateChange"
Код:
if(newstate==PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid == 103 || 104 || 105 || 106 || 107 || 108 || 109) // GOVERNMENT VEHICLES
{
if(gteam[playerid] != Team_GOV)
{
printf("DEBUG: gteam[%d] = %d, Team_GOV = %d", playerid, gteam[playerid], Team_GOV);
SendClientMessage(playerid, COLOR_YELLOW, "(INFO) You are not authorised to use that vehicle.");
RemovePlayerFromVehicle(playerid);
}
}
}
Re: If team does not equal ... -
K9Alex - 26.06.2013
I'm still seeking help for this problem.