how to test?
#1

Hello.
I like to test a anti team carjack.
I made a new windows 7 user, because i don't can test alone the anti team carjack.
and then, the player are above the vehicle, so he (I xD) doesn't are in the vehicle, because he aren't ingame. So i don't can test it.

whats an alternative?

btw: my code:

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerInVehicle(i,vehicleid) && gTeam[i] == gTeam[playerid])
    {
     // As test i made this:
      if (!ispassenger)
      {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
        SetPlayerPos(playerid, x, y, z);
      }
  }
  }
return 1;
}
Reply
#2

This isn't nessicary that accurate because the player doesn't always follow through with entering the vehicle, it can be cancelled by the player in case it was just a mistake, but I've created a anti-jack script before that did work for me...

This is performed under OnPlayerStateChange: Each time a player's new state is driver, perform a check on the same vehicle if any other player either had or has the driver state with the same vehicle id of the new driver & I also threw in a range check just to be sure. But it's always best to test with a friend & also keep tracking of what is going on in your code using some form of alert. Example, when my anti-vehicle-jack went off, it sent a message that this guy stole this car from that guy to all admins/cops currently online. So it wasn't long before I knew my code was working etc.

Oh and also throw in a check if either of the players are currently a passenger too!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)