Originally Posted by [ISS]jumbo
pawn Код:
stock GetWeaponID(name[]) { for(new wps=0; wps < 48; wps++) { if (wps==19||wps==20||wps== 21) continue; if (strfind(WeaponNames[wps],name, true) != -1) { return wps; } } return -1; }
pawn Код:
new WeaponNames[][] = { {"Unarmed (Fist)"},{"Brass Knuckles"}, {"Golf Club"}, {"Night Stick"}, {"Knife"}, {"Baseball Bat"}, {"Shovel"}, {"Pool Cue"}, {"Katana"}, {"Chainsaw"}, {"Purple Dildo"}, {"Big White Vibrator"}, {"Medium White Vibrator"}, {"Small White Vibrator"}, {"Flowers"}, {"Cane"}, {"Grenade"}, {"Teargas"},{"Molotov"}, {" "},{" "},{" "},{"Colt "},{"Colt (Silenced)"},{"Desert Eagle"},{"Normal Shotgun"},{"Sawnoff Shotgun"},{"Combat Shotgun"}, {"Micro Uzi (Mac )"}, {"MP"},{"AK"},{"M4"},{"Tec"},{"Country Rifle"},{"Sniper Rifle"},{"Rocket Launcher"},{"Heat-Seeking Rocket Launcher"},{"Flamethrower"}, {"Minigun"}, {"Satchel Charge"},{"Detonator"},{"Spray Can"},{"Fire Extinguisher"},{"Camera"},{"Night Vision Goggles"},{"Infrared Vision Goggles"},{"Parachute"},{"Fake Pistol"} };
...
pawn Код:
YCMD:giveweapon(playerid, params[], help) { new pid; new str[128]; new weapon[32]; new ammo; if(PlayerInfo[playerid][pAdmin] < 8 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, ADMIN_CMD_ERROR); if (help) return SendClientMessage(playerid, COMMAND_HELP_COLOR, "Gives a player a gun."); if (sscanf(params, "us[32]d", pid,weapon,ammo)) return SendClientMessage(playerid, COMMAND_PRINT, "Usage: /giveweapon <playerid/name> <weaponid> <ammo amount>."); if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, ERROR_COLOR, PCONNECT); new wepname = GetWeaponID(weapon); format(str, sizeof (str), "You have given %s [%d] Weapon id [%d] With %d amount of ammo %s",GetName(pid),pid,weapon,ammo,WeaponNames[weaponid]); SendClientMessage(playerid, COMMAND_PRINT, str); GivePlayerWeapon(pid,wepname,ammo); return 1; }
prob some warning but fix it
|