cop car problem
#1

Hello all im having trouble with my cop system everytime a cop get`s in the cop car it say`s You Are Not A Police Officer! and ejects em I was wondering any problems with my cop car setup thank`s.
Код:
 if(newstate==PLAYER_STATE_DRIVER){
		new VID=GetPlayerVehicleID(playerid);
    if(JobCop[playerid] == 1){
		if(GetVehicleModel(VID) == 596 || GetVehicleModel(VID) == 597 || GetVehicleModel(VID) == 598 || GetVehicleModel(VID) == 599){
   	   RemovePlayerFromVehicle(playerid);
   	   SendClientMessage(playerid, COLOR_RED, "You Are Not A Police Officer!.");
   		}
 		}
	}
	return 1;
}
Reply
#2

try this:
Код:
 if(newstate==PLAYER_STATE_DRIVER){
		new VID=GetPlayerVehicleID(playerid);
    if(JobCop[playerid] == 0){
		if(GetVehicleModel(VID) == 596 || GetVehicleModel(VID) == 597 || GetVehicleModel(VID) == 598 || GetVehicleModel(VID) == 599){
   	   RemovePlayerFromVehicle(playerid);
   	   SendClientMessage(playerid, COLOR_RED, "You Are Not A Police Officer!.");
   		}
 		}
	}
	return 1;
}
It is just a gues, explain more about the variables you are using.
Reply
#3

Quote:
Originally Posted by Jokel317
Hello all im having trouble with my cop system everytime a cop get`s in the cop car it say`s You Are Not A Police Officer! and ejects em I was wondering any problems with my cop car setup thank`s.
Код:
 if(newstate==PLAYER_STATE_DRIVER){
		new VID=GetPlayerVehicleID(playerid);
    if(JobCop[playerid] == 1){
		if(GetVehicleModel(VID) == 596 || GetVehicleModel(VID) == 597 || GetVehicleModel(VID) == 598 || GetVehicleModel(VID) == 599){
   	   RemovePlayerFromVehicle(playerid);
   	   SendClientMessage(playerid, COLOR_RED, "You Are Not A Police Officer!.");
   		}
 		}
	}
	return 1;
}
Change to:

pawn Код:
new JobCop[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
  new Skin = GetPlayerSkin(playerid);
  if(Skin == 285)
  {
  JobCop[playerid] = 1;
  }

  if(Skin != 285)
  {
  JobCop[playerid] = 0;
  }
  return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
  if(newstate==PLAYER_STATE_DRIVER)
  {
  new vid = GetPlayerVehicleID(playerid);

  if(JobCop[playerid] == 0)
  {
  if(GetVehicleModel(vid) == 596 || GetVehicleModel(vid) == 597 || GetVehicleModel(vid) == 598 || GetVehicleModel(vid) == 599)
  {
  RemovePlayerFromVehicle(playerid);
  SendClientMessage(playerid, COLOR_RED, "You Are Not A Police Officer!.");
  }
  }
  }
  return 1;
}
Reply
#4

Thanks guys very much will try it out.
Reply
#5

Hello i decided show the script im using it`s a modified Career 1.4 by Jesse. If you see any errors in it let me know. Cause im getting these errors up on compiling idk if they will have any effect yet or not thanks for looking.

Here`s link to my script http://pastebin.ca/1652029

Here`s the errors i know the loose identations should have no effect lol.

Career.pwn(110) : warning 217: loose indentation
Career.pwn(111) : warning 217: loose indentation
Career.pwn(112) : warning 206: redundant test: constant expression is non-zero
Career.pwn(131) : warning 217: loose indentation
Career.pwn(131) : warning 206: redundant test: constant expression is non-zero
Career.pwn(149) : warning 217: loose indentation
Career.pwn(149) : warning 206: redundant test: constant expression is non-zero
Career.pwn(154) : warning 217: loose indentation
Career.pwn(155) : warning 217: loose indentation
Career.pwn(156) : warning 217: loose indentation
Career.pwn(169) : warning 217: loose indentation
Career.pwn(169) : warning 206: redundant test: constant expression is non-zero
Career.pwn(187) : warning 206: redundant test: constant expression is non-zero
Career.pwn(510) : warning 217: loose indentation
Career.pwn(555) : warning 217: loose indentation
Career.pwn(697) : warning 217: loose indentation

Reply
#6

it will still compile with those warnings.

there is a code to ignore the indents of the script im sure someone will post it
Reply
#7

Thank`s for heads up. Seems be working fine only problem now is with the arrest command. Showing up as a unknown command but that`s been happening for a bit now not related to that.
Reply
#8

Career.pwn(187) : warning 206: redundant test: constant expression is non-zero
Код:
if(Skin == 61,253)
shouldnt this be an Or statment rather than a comma ??
Код:
if(Skin == 61 || Skin == 253)
same with the other "warning 206: redundant test: constant expression is non-zero"
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)