IsACopCar - Kicks you off if duty == 0
#1

Hello i got this lines :
And i want to add if(OnDuty[playerid]==0)
it kicks you off the bike. But how do i do it correctly so it wont give me errors ?
Code:
		if (IsACopCar(vehicleid) && !ispassenger)
		{
			if(PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pLeader]==3||PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pMember]==3) {}
			else {
				//WantedPoints[playerid]+=2;
				//SetPlayerCriminal(playerid,255, "Stealing A Police Vehicle");
				new Float:cx, Float:cy, Float:cz;
				GetPlayerPos(playerid, cx, cy, cz);
				SetPlayerPos(playerid, cx, cy, cz);
			}
		}
Reply
#2

pawn Code:
if(IsACopCar(vehicleid))
{
if(OnDuty[playerid]==0)
{
RemovePlayerFromVehicle(playerid);
}
}
That should work
Reply
#3

Yes but what if you're then on medic duty ? then you're able to use this vehicle.. I want it also to check that the player is pMember 1 / pLeader 1
and so on.
Reply
#4

Quote:
Originally Posted by Chivava
Yes but what if you're then on medic duty ? then you're able to use this vehicle.. I want it also to check that the player is pMember 1 / pLeader 1
and so on.
pawn Code:
if(IsACopCar(vehicleid))
{
if(OnDuty[playerid]==0)
{
RemovePlayerFromVehicle(playerid);
if(OnMDuty[playerid]==1)
{
}
}
}
Untested and doubt its going to work, Try it and tell me if it does or not,
I cant do the pMember and pLeader as im unsure the actual code
Reply
#5

The main problem is just that if you jsut says about duty it self it wont prevent pizza boys and so on from using them.
Reply
#6

Code:
		if (IsACopCar(vehicleid) && !ispassenger)
		{
			if(PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pLeader]==3||PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pMember]==3) {}
			else {
                if(PlayerInfo[playerid][pMedicDuty] == 0)
                {
                   SendClientMessage(playerid, COLOR_GRAD3, "You are not on-duty as a medic!");
				   new Float:cx, Float:cy, Float:cz;
				   GetPlayerPos(playerid, cx, cy, cz);
				   SetPlayerPos(playerid, cx, cy, cz);
                   return 1;
                }
				//WantedPoints[playerid]+=2;
				//SetPlayerCriminal(playerid,255, "Stealing A Police Vehicle");
				new Float:cx, Float:cy, Float:cz;
				GetPlayerPos(playerid, cx, cy, cz);
				SetPlayerPos(playerid, cx, cy, cz);
			}
		}
Reply
#7

Okay i'll try that.
Reply
#8

How do i make it so it checks if im in faction 1 and if im in faction it will go check if im on duty, if not then it kicks me off the vehicle... ?
Reply
#9

Quote:
Originally Posted by Chivava
How do i make it so it checks if im in faction 1 and if im in faction it will go check if im on duty, if not then it kicks me off the vehicle... ?
You meen this?

pawn Code:
if(PlayerInfo[playerid][pMember] != 1 || OnDuty[playerid] == 0)
{
  RemovePlayerFromVehicle(playerid);
}
Reply
#10

this is how it looks alike now but it comes up with errors :

Code:
		if (IsACopCar(vehicleid) && !ispassenger)
		{
			if(PlayerInfo[playerid][pMember] != 1 || OnDuty[playerid] == 0)
			{
  		RemovePlayerFromVehicle(playerid);
			}
   			SendClientMessage(playerid, COLOR_GRAD3, "You are not on duty as Police Officer");
	   		new Float:cx, Float:cy, Float:cz;
		   	GetPlayerPos(playerid, cx, cy, cz);
				SetPlayerPos(playerid, cx, cy, cz);
				return 1;
				}
				//WantedPoints[playerid]+=2;
				//SetPlayerCriminal(playerid,255, "Stealing A Police Vehicle");
				new Float:cx, Float:cy, Float:cz;
				GetPlayerPos(playerid, cx, cy, cz);
				SetPlayerPos(playerid, cx, cy, cz);
			}
		}
Errors :

Code:
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2172) : warning 219: local variable "cx" shadows a variable at a preceding level
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2172) : warning 219: local variable "cy" shadows a variable at a preceding level
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2172) : warning 219: local variable "cz" shadows a variable at a preceding level
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2179) : warning 219: local variable "cx" shadows a variable at a preceding level
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2179) : warning 219: local variable "cy" shadows a variable at a preceding level
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2179) : warning 219: local variable "cz" shadows a variable at a preceding level
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2183) : warning 209: function "OnPlayerEnterVehicle" should return a value
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2184) : error 010: invalid function or declaration
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2186) : error 010: invalid function or declaration
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2187) : error 010: invalid function or declaration
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2191) : error 021: symbol already defined: "GetPlayerPos"
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2195) : error 010: invalid function or declaration
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2197) : error 010: invalid function or declaration
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2198) : error 010: invalid function or declaration
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2200) : error 010: invalid function or declaration
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2202) : error 010: invalid function or declaration
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2203) : error 010: invalid function or declaration
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2205) : error 010: invalid function or declaration
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2207) : error 010: invalid function or declaration
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2208) : error 010: invalid function or declaration
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2210) : error 021: symbol already defined: "cx"
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2210) : error 021: symbol already defined: "cz"
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(2216) : error 010: invalid function or declaration
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(21305) : warning 219: local variable "cx" shadows a variable at a preceding level
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(21305) : warning 219: local variable "cy" shadows a variable at a preceding level
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(21305) : warning 219: local variable "cz" shadows a variable at a preceding level
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(21965) : warning 204: symbol is assigned a value that is never used: "item"
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(22149) : warning 204: symbol is assigned a value that is never used: "item"
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(43272) : warning 219: local variable "cx" shadows a variable at a preceding level
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(43272) : warning 219: local variable "cy" shadows a variable at a preceding level
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(43272) : warning 219: local variable "cz" shadows a variable at a preceding level
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(45221) : warning 203: symbol is never used: "cx"
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(45221) : warning 203: symbol is never used: "cy"
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.pwn(45221) : warning 203: symbol is never used: "cz"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)