04.11.2016, 17:13
well..so i've made a command with /giveallweapon and it works well..but the only issue i face is when it sends the message to the players..it doesn't show the weapon's name:
Quote:
CMD:giveallweapons(playerid, params[]) { new weaponid,model[50],ammo; if(pInfo[playerid][Admin]<4) return SendClientMessage(playerid, RED, "ERROR: You are not authorized to use this command"); if(sscanf(params, "si", model, ammo)) return SendClientMessage(playerid, RED, "ERROR: /giveallweapon [weaponid] [ammo]"); weaponid = GetWeaponNameID(model); if(weaponid > 47 || weaponid < 1) return SendClientMessage (playerid, RED, "ERROR: Invailed weapon name"); foreach(Player,i) { GivePlayerWeapon(i, weaponid, ammo); PlayerPlaySound(i, 1057,0.0,0.0,0.0); } format(str, SOS, "Administrator %s has given all players weapon [%s] with [%i] ammo ", pInfo[playerid][Name], weaponid, ammo); SendClientMessageToAll(BLUE, str); format(str, SOS, "Admin: %s has used command GIVEALLWEAPONS", pInfo[playerid][Name]); SendCMDAdmin(BLUE, str); return 1; } |
Quote:
stock GetWeaponNameID(wname[]) { for(new i = 0; i < 42; i++) { if (strfind(WeaponNames[i], wname, true) != -1) return i+4; } return -1; } |