24.06.2015, 00:56
i want disable ak47 if player is in pessenger seat. how?
OnPlayerEnterVehicle(...) { if(ispassenger) { if(GetPlayerWeapon(playerid) == AK ID) ....... Prohibition Code. Maybe change he's weapon or remove he's or anything you want! } } }
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
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(playerid, weaponid)
{
SetPlayerArmedWeapon(playerid, weaponid);
if (GetPlayerWeapon(playerid) != 0) GivePlayerWeapon(playerid, -(GetPlayerAmmo(playerid)));
return 1;
}
PHP код:
KillerDVX, |
if (GetPlayerWeapon(playerid) != 0) GivePlayerWeapon(playerid, -(GetPlayerAmmo(playerid)));
OnPlayerStateChange(playerid, newstate, oldstate) { if (newstate == PLAYER_STATE_PASSENGER) { if (GetPlayerWeapon(playerid) == WEAPON_AK47) { SetPlayerArmedWeapon(playerid, 0); } } return 1; }