SA-MP Forums Archive
Deagle not available in vehicle(rep+) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Deagle not available in vehicle(rep+) (/showthread.php?tid=304225)



Deagle not available in vehicle(rep+) - Ballu Miaa - 17.12.2011

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?


Re: Deagle not available in vehicle(rep+) - Neo Karls - 17.12.2011

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;
 }



Re: Deagle not available in vehicle(rep+) - Laronic - 17.12.2011

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


Re: Deagle not available in vehicle(rep+) - kizla - 17.12.2011

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



Re: Deagle not available in vehicle(rep+) - Ballu Miaa - 17.12.2011

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+)


Re: Deagle not available in vehicle(rep+) - LiamM - 17.12.2011

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!


Re: Deagle not available in vehicle(rep+) - Ballu Miaa - 17.12.2011

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


Re: Deagle not available in vehicle(rep+) - Berky - 17.12.2011

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.


Re: Deagle not available in vehicle(rep+) - Ballu Miaa - 18.12.2011

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


Re: Deagle not available in vehicle(rep+) - Rob_Maate - 18.12.2011

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);
    }