CMD:weapons(playerid, params[]) { new range[100]; if(GetPlayerTeam(playerid) == 1) //red { range = "-507.8125, 2107.421875, -267.578125, 2316.40625"; } else if(GetPlayerTeam(playerid) == 2) // blue { range = "3.90625, 1656.25,382.8125, 2121.0975"; } else { SendClientMessage(playerid, -1, "You first choose a team and then you can try it again ;)."); } if(IsPlayerInRangeOfPoint(playerid, range)) { ShowPlayerDialog(playerid, SHOP_DIALOG, DIALOG_STYLE_LIST, "Weapon Shop", "Deagle: $500\nSawn-Off: $1000\nM4: $2000\nSniper: $3000", "Select", "Exit");//Show them the dialog. return true; } else { SendClientMessage(playerid, -1, "You must be at your own base to buy weapons."); } return true; }
if(IsPlayerInRangeOfPoint(playerid, range))
if(IsPlayerInRangeOfPoint(playerid, 3.90625, 1656.25,382.8125, 2121.0975))
CMD:weapons(playerid, params[])
{
static Float:_range, Float:posX, Float:posY, Float:posZ;
if(GetPlayerTeam(playerid) == 1) //red
{
_range = "-507.8125", posX = "2107.421875", posY = "-267.578125", posZ = "2316.40625";
}
else if(GetPlayerTeam(playerid) == 2) // blue
{
_range = "3.90625", posX = "1656.25", posY = "382.8125", posZ = "2121.0975";
}
else
{
SendClientMessage(playerid, -1, "You first choose a team and then you can try it again ;).");
}
if(IsPlayerInRangeOfPoint(playerid, _range, posX, posY, posZ))
{
ShowPlayerDialog(playerid, SHOP_DIALOG, DIALOG_STYLE_LIST, "Weapon Shop", "Deagle: $500\nSawn-Off: $1000\nM4: $2000\nSniper: $3000", "Select", "Exit");//Show them the dialog.
return true;
}
else
{
SendClientMessage(playerid, -1, "You must be at your own base to buy weapons.");
}
return true;
}
pawn Код:
|
It's parameter is IsPlayerInRangeOfPoint(playerid,range, Float: x, Float:y,Float:z)
|
if(GetPlayerTeam(playerid) == 1) //red
{
if(IsPlayerInRangeOfPoint(playerid, -507.8125, 2107.421875, -267.578125, 2316.40625))
{
ShowPlayerDialog(playerid, SHOP_DIALOG, DIALOG_STYLE_LIST, "Weapon Shop", "Deagle: $500\nSawn-Off: $1000\nM4: $2000\nSniper: $3000", "Select", "Exit");//Show them the dialog.
return true;
}
}
else if(GetPlayerTeam(playerid) == 2) // blue
{
if(IsPlayerInRangeOfPoint(playerid, 3.90625, 1656.25,382.8125, 2121.0975))
{
ShowPlayerDialog(playerid, SHOP_DIALOG, DIALOG_STYLE_LIST, "Weapon Shop", "Deagle: $500\nSawn-Off: $1000\nM4: $2000\nSniper: $3000", "Select", "Exit");//Show them the dialog.
return true;
}
}
IsPlayerInRangeOfPoint(playerid, 3.90625, 1656.25,382.8125, 2121.0975) || IsPlayerInRangeOfPoint(playerid, -507.8125, 2107.421875, -267.578125, 2316.40625))