04.06.2014, 07:59
How to make a radius point that when player enter the radius they cant use the weapon, unless they are out from the radius they can use it again.
if(IsPlayerInRangeOfPoint(playerid,playerid, Float:radius, Float:x, Float:y, Float:z))
{
if(Weapon[playerid]==1)
{
ResetPlayerWeapons(playerid);
}
}
public OnPlayerUpdate(playerid)
{
if(IsPlayerInRangeOfPoint(...)) //If they are in the range that you want
{
if(GetPlayerWeapon(playerid)!=0) //If They have another weapon beside fist
{
SetPlayerArmedWeapon(playerid,0); //Set their armed weapon to fist
}
}
}
if(IsPlayerInRangeOfPoint(playerid,playerid, Float:radius, Float:x, Float:y, Float:z))
{
if(Weapon[playerid]==1)
{
for(i=0;i<13;i++)
{
array=GetPlayerWeapon(playerid); //make an array to store weapons
}
ResetPlayerWeapons(playerid);
}
}
else
{
for(i=0;i<13;i++)
{
GivePlayerWeapon(playerid,make an array here,ammo);
}
}
|
Is this also include if they spawn a weapon in the radius, doest it be reset also?
|
new g_iWeaponExcepted[MAX_PLAYERS];
if(IsPlayerAdmin(playerid)) //if the player is an RCON admin they can use a gun in the area
g_iWeaponExcepted[playerid] = 1;
if(IsPlayerInRangeOfPoint(playerid, 50.0, x, y, z) && g_iWeaponExcepted[playerid] != 1)
{
//disarms the player
}