28.01.2012, 13:29
In my server a player can drive by with any weapon how can I make some weapons not drivebyable?
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;
}
* * if(GetPlayerWeapon(playerid) == 24 )//this is for desert eagle you can add more.
* * {
* * * * SetPlayerArmedWeapon(playerid, 0);
* * }
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;
}
hmm just saying, would this work?
pawn Код:
|
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.
|