Anti-Jack is killing passengers too ;(
#1

Ok so heres the code, My problem is that its continually killing the passenger, I haven't yet figured out how to fix this:

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  for(new i = 0; i < GetMaxPlayers(); i++)
  {
    if (IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
    {
            SetPlayerHealth(playerid, 0);
			new pName[MAX_PLAYER_NAME],string[128];
			GetPlayerName(playerid, pName, sizeof(pName));
			format(string, sizeof(string), "[Anti-Jack]: %s has just been killed for car jacking (n00b!).", pName);
			SendClientMessageToAll(red, string);
            SendClientMessage(playerid,red,"Error: Car jacking is not allowed!.");
    }
  }
  return 1;
}
How could i fix it so it doesn't kill the passengers entering?
Reply
#2

When this is called the player is not currently in the car, So they wouldn't be a passenger....
Reply
#3

No, Its supposed to kill somebody trying to jack the car, Not a passenger trying to enter.
Reply
#4

Quote:
Originally Posted by » ραωпsтαг «
Try this ...

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  for(new i = 0; i < GetMaxPlayers(); i++)
  {
    if (IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == PLAYER_STATE_DRIVER) && GetPlayerState(playerid) == 5)
    {
            SetPlayerHealth(playerid, 0);
			new pName[MAX_PLAYER_NAME],string[128];
			GetPlayerName(playerid, pName, sizeof(pName));
			format(string, sizeof(string), "[Anti-Jack]: %s has just been killed for car jacking (n00b!).", pName);
			SendClientMessageToAll(red, string);
            SendClientMessage(playerid,red,"Error: Car jacking is not allowed!.");
    }
  }
  return 1;
}
Info.

Or try the one above.



Dont work errors

C:\Users\robmob\Desktop\The New World 2\gamemodes\NextBigThing.pwn(350 : error 029: invalid expression, assumed zero
C:\Users\robmob\Desktop\The New World 2\gamemodes\NextBigThing.pwn(350 : warning 215: expression has no effect
C:\Users\robmob\Desktop\The New World 2\gamemodes\NextBigThing.pwn(350 : error 001: expected token: ";", but found ")"
C:\Users\robmob\Desktop\The New World 2\gamemodes\NextBigThing.pwn(350 : error 029: invalid expression, assumed zero
C:\Users\robmob\Desktop\The New World 2\gamemodes\NextBigThing.pwn(350 : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

with line

if (IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == PLAYER_STATE_DRIVER) && GetPlayerState(playerid) == 5)
Reply
#5

Quote:
Originally Posted by [SF
robmob ]
if (IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == PLAYER_STATE_DRIVER) && GetPlayerState(playerid) == 5)
pawn Код:
if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == PLAYER_STATE_DRIVER && GetPlayerState(playerid) == 5)
Reply
#6

it compiled but it did nothing
Reply
#7

i have error in this filterscript



http://www.m5zn.com/uploads/2010/6/2...52vceysn0p.bmp
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)