02.01.2012, 14:11
Hi,
Is it possible to restrict drive-bys (not the passenger but the driver ones)?
Thanks in advance!
Is it possible to restrict drive-bys (not the passenger but the driver ones)?
Thanks in advance!
new bool:RestrictedDriveBy[MAX_PLAYERS]; // On topof script
public OnPlayerEnterVehicle(playerid, vehicleid) {
// Check if the player is the driver
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
ResetPlayerWeapons(playerid); // Reset his weapons
RestrictedDriveBy[playerid] = true;
}
}
public OnPlayerExitVehicle(playerid, vehicleid) {
if(RestrictedDriveBy[playerid] == true) {
GivePlayerWeapons(playerid); // Give him back his weapons (custom)
RestrictedDriveBy[playerid] = false;
}
}
SetPlayerArmedWeapon(playerid,0);
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
SetPlayerArmedWeapon(playerid,0);
return 1;
}
return 1;
}