SA-MP Forums Archive
IsACopCar - Kicks you off if duty == 0 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: IsACopCar - Kicks you off if duty == 0 (/showthread.php?tid=124541)



IsACopCar - Kicks you off if duty == 0 - Chivava - 30.01.2010

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);
			}
		}



Re: IsACopCar - Kicks you off if duty == 0 - Torran - 30.01.2010

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


Re: IsACopCar - Kicks you off if duty == 0 - Chivava - 30.01.2010

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.


Re: IsACopCar - Kicks you off if duty == 0 - Torran - 30.01.2010

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


Re: IsACopCar - Kicks you off if duty == 0 - Chivava - 30.01.2010

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.


Re: IsACopCar - Kicks you off if duty == 0 - NewYorkRP - 30.01.2010

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);
			}
		}



Re: IsACopCar - Kicks you off if duty == 0 - Chivava - 30.01.2010

Okay i'll try that.


Re: IsACopCar - Kicks you off if duty == 0 - Chivava - 30.01.2010

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... ?


Re: IsACopCar - Kicks you off if duty == 0 - matrix_smq - 30.01.2010

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);
}



Re: IsACopCar - Kicks you off if duty == 0 - Chivava - 30.01.2010

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"