16.07.2015, 02:48
hey i want this command to give weapons to all players in range of point and the limit range is 500. and i want to say you give an m4 to all players in rannge of 500m.(15 totals)< this is how many players are in range of 500m.
i need help with giving weapons in range of point
Quote:
CMD:giveallweapon(playerid, params[]) { new weap, ammo, range, str[128], WeapName[32]; if(PlayerAcc[playerid][Log] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You are not logged in!"); if(PlayerAcc[playerid][Admin] >= 4) { if(sscanf(params, "ii", weap, ammo, range)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /giveallweapon (id) (weaponid) (range)"); if(weap == 19 || weap == 20 || weap == 21) return SendClientMessage(playerid, COLOR_RED, "Error: There is no weaponid for 19/20/21!"); if(weap < 1 || weap > 47) return SendClientMessage(playerid, COLOR_RED, "Weapon Maxium (Left): 1 - Maxium (Right): 47"); if(ammo < 1 || ammo > 500) return SendClientMessage(playerid, COLOR_RED, "Ammo Maxium (Left): 0 - Maxium (Right): 500 ***"); if(range< 5 || range> 500) return SendClientMessage(playerid, COLOR_RED, "range Maxium (Left): 5 - Maxium (Right): 500 ***"); GetWeaponName(weap, WeapName, 32); format(str, sizeof(str), "~w~%s ~g~", WeapName, weap); GameTextForAll(str, 4000, 3); foreach(Player, i) { if(IsPlayerConnected(i)) { GivePlayerWeapon(i,weap,ammo); } } format(str, sizeof(str), "Admin %s(%d) gave you a %s", GetName(playerid), playerid, WeapName, weap, ammo); SendClientMessageToAll(COLOR_LIGHTGREEN, str); format(str, sizeof(str), "You given everyone a %s(%d) with %d ammo in range of %m ***", WeapName, weap, ammo, range); SendClientMessage(playerid, COLOR_LIME, str); } else return ErrorMessages(playerid, 5); return 1; } |