Deagle not available in vehicle(rep+)
#1

I've seen this on many servers , That whenever you enter a vehicle being a driver or passenger if you have deagle in your hand it will auto disarm it.. Or hide it you can say?/ I dont know what function or callback their using?

Can someone please helpme make something like this?
Reply
#2

I think this is what you are looking for

pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
 {
  if(newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVER)  SetPlayerArmedWeapon(playerid,   0);
  return 1;
 }
Reply
#3

pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_PASSENGER)
    {
        SetPlayerArmedWeapon(playerid, 0);
    }
    return true;
}
This is setting the "driveby" weapon to "Unarmed (no guns)" for the passenger of a vehicle

Edit: Too late as usually
Reply
#4

pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetPlayerWeapon(playerid)) == 24)
    {
        SetPlayerArmedWeapon(playerid, 0);
    }
return 1;
}
Reply
#5

pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_PASSENGER)
    {
        if(GetPlayerWeapon(playerid) == 24)
        {
            SetPlayerArmedWeapon(playerid, 0);
        }
    }
    return 1;
}
This is what im looking for, Made it with the help of you all!! Thanks alot everyone , Much Love (rep'd+)
Reply
#6

pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate = PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
          if(GetPlayerWeapon(playerid)) == 24)
          {
           SetPlayerArmedWeapon(playerid, 0);
          }
    }
return 1;
}
Edit: Oh I just noticed you made that post, you must done it when I was making this post. Good to hear you found out what you needed!
Reply
#7

Quote:
Originally Posted by LiamM
View Post
Edit: Oh I just noticed you made that post, you must done it when I was making this post. Good to hear you found out what you needed!
All good brother! Thanks for replying. Much Love
Reply
#8

Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate = PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
          if(GetPlayerWeapon(playerid)) != 29) SetPlayerArmedWeapon(playerid, 0);
    }
return 1;
}
Better fix if you want to make the MP5's allowed in a vehicle as passenger.
Reply
#9

Quote:
Originally Posted by Berky
View Post
Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate = PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
          if(GetPlayerWeapon(playerid)) != 29) SetPlayerArmedWeapon(playerid, 0);
    }
return 1;
}
Better fix if you want to make the MP5's allowed in a vehicle as passenger.
No MP5'S In my server xD
Reply
#10

Issue with your script
If the player get's a desert eagle WHILE in the car, they will still be able to driveby with it.

In OnPlayerUpdate,

pawn Code:
if(GetPlayerState(playerid) = PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
    {
          if(GetPlayerWeapon(playerid) == 24) SetPlayerArmedWeapon(playerid, 0);
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)