Forbidden weapons
#1

i want disable ak47 if player is in pessenger seat. how?
Reply
#2

Sorry wat?
Is it possible to get in a car with AK47?
Also If you want to do that and If it's possible,
You should put prohibition code under OnPlayerEnterVehicle or OnPlayerStateChange (section DRIVER).
It's just an Idea.

Код:
OnPlayerEnterVehicle(...)
{
    if(ispassenger)
    {
        if(GetPlayerWeapon(playerid) == AK ID)
            ....... Prohibition Code. Maybe change he's weapon or remove he's or anything you want!
        }
    }
}
Reply
#3

PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    if(
GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
    {
      if(
GetPlayerWeapon(playerid) == 30)
       {
               
RemovePlayerWeapon(playerid,30);
           
GameTextForPlayer(playerid,"~r~your AK47 has been removed!"3000,5);
        return 
1;
    }
    }
    return 
1;
}
stock RemovePlayerWeapon(playeridweaponid)
{
    
SetPlayerArmedWeapon(playeridweaponid);
    if (
GetPlayerWeapon(playerid) != 0GivePlayerWeapon(playerid, -(GetPlayerAmmo(playerid)));
    return 
1;

Hope it helps.

KillerDVX,
Reply
#4

Quote:
Originally Posted by KillerDVX
Посмотреть сообщение
PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    if(
GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
    {
      if(
GetPlayerWeapon(playerid) == 30)
       {
               
RemovePlayerWeapon(playerid,30);
           
GameTextForPlayer(playerid,"~r~your AK47 has been removed!"3000,5);
        return 
1;
    }
    }
    return 
1;
}
stock RemovePlayerWeapon(playeridweaponid)
{
    
SetPlayerArmedWeapon(playeridweaponid);
    if (
GetPlayerWeapon(playerid) != 0GivePlayerWeapon(playerid, -(GetPlayerAmmo(playerid)));
    return 
1;

Hope it helps.

KillerDVX,
Exactly what I was thinkin'. +rep.
Reply
#5

Quote:
Originally Posted by Alpay0098
Посмотреть сообщение
Exactly what I was thinkin'. +rep.
All you have to do, IS SPEEEEEED ! xD

Thanks budd'y :3.
Reply
#6

10114) : warning 202: number of arguments does not match definition

line
PHP код:
    if (GetPlayerWeapon(playerid) != 0GivePlayerWeapon(playerid, -(GetPlayerAmmo(playerid))); 
Reply
#7

He wants to disable the weapon and not removed it.

Код:
OnPlayerStateChange(playerid, newstate, oldstate)
{
	if (newstate == PLAYER_STATE_PASSENGER)
	{
		if (GetPlayerWeapon(playerid) == WEAPON_AK47) {
			SetPlayerArmedWeapon(playerid, 0);
		}
	}
	return 1;
}
Reply
#8

Yeah already did. But thanks.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)