11.04.2013, 00:38
you have a function GiveDodWeapon that shuld give the weapon in distance.. you can make something like
EDIT: i just make some changes with float etc jsut take a look
pawn Код:
CMD:gunnear(playerid, params[])
{
new playerb, gunid, ammo, string[128], Float:distance;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
if(sscanf(params, "iif", gunid, ammo, distance))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /unnear [gunid] [ammo] [distance]");
SendClientMessage(playerid, COLOR_GREEN, "_______________________________________");
SendClientMessage(playerid, COLOR_GREY, "1: Brass Knuckles 2: Golf Club 3: Nite Stick 4: Knife 5: Baseball Bat 6: Shovel 7: Pool Cue 8: Katana 9: Chainsaw");
SendClientMessage(playerid, COLOR_GREY, "10: Purple Dildo 11: Small White Vibrator 12: Large White Vibrator 13: Silver Vibrator 14: Flowers 15: Cane 16: Frag Grenade");
SendClientMessage(playerid, COLOR_GREY, "17: Tear Gas 18: Molotov Cocktail 19: Vehicle Missile 20: Hydra Flare 21: Jetpack 22: 9mm 23: Silenced 9mm 24: Desert Eagle 25: Shotgun");
SendClientMessage(playerid, COLOR_GREY, "26: Sawnoff Shotgun 27: SPAS-12 28: Micro SMG (Mac 10) 29: SMG (MP5) 30: AK-47 31: M4 32: Tec9 33: Rifle");
SendClientMessage(playerid, COLOR_GREY, "25: Shotgun 34: Sniper Rifle 35: Rocket Launcher 36: HS Rocket Launcher 37: Flamethrower 38: Minigun 39: Satchel Charge");
SendClientMessage(playerid, COLOR_GREY, "40: Detonator 41: Spraycan 42: Fire Extinguisher 43: Camera 44: Nightvision Goggles 45: Infared Goggles 46: Parachute");
SendClientMessage(playerid, COLOR_GREEN, "_______________________________________");
return 1;
}
if(gunid < 0 || gunid > 46 || gunid == 19 || gunid == 20 || gunid == 21) return SendClientMessage(playerid, COLOR_GREY, "Invalid weapon id.");
new Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
for(new i=0; i != MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i,distance, pos[0], pos[1], pos[2])) {
GivePlayerWeapon(i,gunid,ammo);
}
}
format(string, sizeof(string), "%s has givin everyone online gun %s with %d ammo with %f range from his position.", RPN(playerb), RWN(gunid), ammo, distance);
SendClientMessageToAll(playerid, COLOR_WHITE, string);
return 1;
}
EDIT: i just make some changes with float etc jsut take a look