Anti Team Jack
#1

Well guys, I need your help on Anti Team jack. Can someone provide me the code to do so? I have set the teams with SetPlayerTeam(playerid, IDs). I just need help now, on making it Anti-Team jack. +REP for those who help with this. My hands are just tied with other things. Thanks in advance.
Reply
#2

The code will go under OnPlayerEnterVehicle, loop the players, if the team mate in the vehicle is a driver, break the loop and stop him.
Reply
#3

But could you provide the code, that would be big help. Thanks.
Reply
#4

PHP код:
stock GetDriverID(vehicleid)
{
    for(new 
0MAX_PLAYERSi++) if(IsPlayerConnected(i)) //Loops through all players
    
{
        if(
GetPlayerVehicleID(i) == vehicleid && GetPlayerState(i) == PLAYER_STATE_DRIVER) return i;
    }
    return 
1;
}
public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
  new 
id GetDriverID(vehicleid);
  if(
IsPlayerInAnyVehicle(id) && !ispassenger && GetPlayerTeam(playerid) == GetPlayerTeam(id))
  {
    
// your code to kick him out
  
}
  return 
1;

Reply
#5

My code to kick him out, was just ClearAnimations(playerid); so that the animation will stop. I placed the stock below my script, compiled it and found no errors. Problem is can't test, how it works fine.
Reply
#6

It'll work.
Reply
#7

Alright, +REP to you guys. I will be able to try this weekend, if I find errors, I'll repost here. Thanks to both of ya'll.
Reply
#8

Quote:
Originally Posted by Sting.
Посмотреть сообщение
Alright, +REP to you guys. I will be able to try this weekend, if I find errors, I'll repost here. Thanks to both of ya'll.
I know its a dumb suggestion, But it can add a cool feature to your script.

Add SendClienMessage to it

So it will be :
PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger

  new 
id GetDriverID(vehicleid); 
  if(
IsPlayerInAnyVehicle(id) && !ispassenger && GetPlayerTeam(playerid) == GetPlayerTeam(id)) 
  { 
    
Clearplayeranimation(playerid);
    
Sendclientmessage(PlayeridCOLOR_RED"Don't Ninja Jack your teammates"); //You need to define COLOR_RED to 0xAA3333FF, Or just replace It with another color, Or just put the hex directly
  

  return 
1

Reply
#9

Yea mate, I used GameTextForPlayer instead but thanks. +REP for looking out.
Reply
#10

Quote:
Originally Posted by Sting.
Посмотреть сообщение
Yea mate, I used GameTextForPlayer instead but thanks. +REP for looking out.
Thx, I will +Rep you back.

Btw, You can use both.
They would be awesome together.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)