CMD:setarmors(playerid, params[]) // Sasoft
{
if (PlayerInfo[playerid][pAdmin] >= 3)
{
new string[128], radius, ar;
if(sscanf(params, "dd", ar, radius))
{
SendClientMessageEx(playerid, COLOR_GRAD6, "[Syntax]: /setarmors [armor] [radius]");
return 1;
}
if(radius < 1 || radius > 50)
{
SendClientMessageEx(playerid, COLOR_WHITE, "Radius must be higher than 0 and lower than 51!");
return 1;
}
if(ar < 1 || ar > 100)
{
SendClientMessageEx(playerid, COLOR_WHITE, "Armour must be higher than 1 and lower than 101!");
return 1;
}
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid,X, Y, Z);
for (new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(playerid, radius, X, Y, Z))
{
SetPlayerArmour(playerid, ar);
format(string, sizeof(string), "> Admin %s uses his magic and shoots a wave of armour in your direction.", GetPlayerNameEx(playerid));
SendClientMessageEx(playerid, COLOR_LIGHTGREEN, string);
}
}
format(string, sizeof(string), "You have given everyone %d armour in %d radius", ar, radius);
SendClientMessageEx(playerid, COLOR_LIGHTGREEN, string);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}
CMD:setarmors(playerid, params[]) // Sasoft
{
if (PlayerInfo[playerid][pAdmin] >= 3)
{
new string[128], radius, ar;
if(sscanf(params, "dd", ar, radius))
{
SendClientMessageEx(playerid, COLOR_GRAD6, "[Syntax]: /setarmors [armor] [radius]");
return 1;
}
if(radius < 1 || radius > 50)
{
SendClientMessageEx(playerid, COLOR_WHITE, "Radius must be higher than 0 and lower than 51!");
return 1;
}
if(ar < 1 || ar > 100)
{
SendClientMessageEx(playerid, COLOR_WHITE, "Armour must be higher than 1 and lower than 101!");
return 1;
}
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid,X, Y, Z);
for (new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, radius, X, Y, Z))
{
SetPlayerArmour(i, ar);
format(string, sizeof(string), "> Admin %s uses his magic and shoots a wave of armour in your direction.", GetPlayerNameEx(playerid));
SendClientMessageEx(playerid, COLOR_LIGHTGREEN, string);
}
}
format(string, sizeof(string), "You have given everyone %d armour in %d radius", ar, radius);
SendClientMessageEx(playerid, COLOR_LIGHTGREEN, string);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}
if(sscanf(params, "ff", ar, radius))
Firstly I'd like to state that "radius" (used in IsPlayerInRangeOfPoint and the SSCANF function) should be a float instead of integrer, as also should the armor variable, because it needs a float. so you should use
pawn Код:
|
new string[128], ar, radius;
new string[128], Float:ar, Float:radius;
This one is true, you should do that.
Also change pawn Код:
pawn Код:
|