SA-MP Forums Archive
need help! - 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: need help! (/showthread.php?tid=314049)



need help! - KosmasRego - 28.01.2012

In my server a player can drive by with any weapon how can I make some weapons not drivebyable?


Re: need help! - sabretur - 28.01.2012

You can remove player's weapons when the player enters a vehicle.


Re: need help! - KosmasRego - 28.01.2012

Let's try it again...
When a player enters with a M4, SMG[mp5], a deagle, and a combat. I want to make it only DB with M4 and SMG. But now it DBs when you have Deagle and combat


Re: need help! - [MG]Dimi - 28.01.2012

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    if(IsPlayerInAnyVehicle(issuerid) && (weaponid !=31 || weaponid != 29))
    {
        SetPlayerHealth(issuerid,-100.0);
        SendClientMessage(playerid,0xFF0000FF,"Drive-by isn;'t allowed!");
    }
    return 1;
}
Something like this?


Re: need help! - KosmasRego - 28.01.2012

No.

When I enter a car as a passenger I can drive by with ALL weapons. How can I make some weapons not to drive by with.


Re: need help! - [HK]Ryder[AN] - 28.01.2012

I understood
Add this code under OnPlayerEnterVehicle
pawn Код:
* * if(GetPlayerWeapon(playerid) == 24 )//this is for desert eagle you can add more.
* * {
* * * * SetPlayerArmedWeapon(playerid, 0);
* * }
If u see the * marks then pls remove them idk how they came.if u.dont see them its good.


Re: need help! - [KHK]Khalid - 28.01.2012

hmm just saying, would this work?

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     new pstate = GetPlayerState(playerid);
     if(pstate == PLAYER_STATE_PASSENGER) // change PASSENGER to DRIVER if you want
     {      
          if(GetPlayerWeapon(playerid) == 24) // 24 is the deagle id
          {
                   SetPlayerArmedWeapon(playerid,0); // will disable the player's weapon
          }
        // here you can put more undrivebyable weapons like the lines ABOVE ^
     }
return 1;
}



Re: need help! - [HK]Ryder[AN] - 28.01.2012

Quote:
Originally Posted by HellSphinX
Посмотреть сообщение
hmm just saying, would this work?

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     new pstate = GetPlayerState(playerid);
     if(pstate == PLAYER_STATE_PASSENGER) // change PASSENGER to DRIVER if you want
     {      
          if(GetPlayerWeapon(playerid) == 24) // 24 is the deagle id
          {
                   SetPlayerArmedWeapon(playerid,0); // will disable the player's weapon
          }
        // here you can put more undrivebyable weapons like the lines ABOVE ^
     }
return 1;
}
according to your code driver can driveby but passenger can't.in my code above both can't driveby and whats the need to check player state because he us in a vehicle and thats what we need.


Re: need help! - [KHK]Khalid - 28.01.2012

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
according to your code driver can driveby but passenger can't.in my code above both can't driveby and whats the need to check player state because he us in a vehicle and thats what we need.
Quote:
Originally Posted by KosmasRego
Посмотреть сообщение
No.

When I enter a car as a passenger I can drive by with ALL weapons. How can I make some weapons not to drive by with.
i thought he want it when a player enter a vehicle as a PASSENGER!


Re: need help! - KosmasRego - 28.01.2012

ty HellSphinX and Ryder rep ++