Galera por que quando eu uso o comando /giveallweapon pra dar armas para todos os players com uma determinada muniзгo ele nгo seta as muniзхes tipo /giveallweapon id 999 ae nгo da muniзгo nenhuma ae quando eu coloco assim /giveallweapon id ele seta 500 muniзхes
Код:
dcmd_giveallweapon(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 5) {
new tmp[256], tmp2[256], Index, ammo, weap, WeapName[32], string[128]; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(!strlen(tmp) ) return SendClientMessage(playerid, red, "USO: /giveallweapon [weapon id/weapon name] [ammo]");
if(!strlen(tmp2) || !IsNumeric(tmp2) || strval(tmp2) <= 0 || strval(tmp2) > 99999) ammo = 500;
if(!IsNumeric(tmp)) weap = GetWeaponIDFromName(tmp); else weap = strval(tmp);
if(!IsValidWeapon(weap)) return SendClientMessage(playerid,red,"ERROR: Invalid weapon ID");
if(weap == 43||weap == 44||weap == 45||weap == 36||weap == 37 ||weap == 18||weap == 38||weap == 35){
SendClientMessage(playerid,red,"[ERRO]: ID de weapon ilegal para player");
return 1;}
CMDMessageToAdmins(playerid,"GIVEALLWEAPON");
for (new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)){
PlayerPlaySound(i,1057,0.0,0.0,0.0);
GivePlayerWeapon(i,weap,ammo);
}
}
GetWeaponName(weap, WeapName, sizeof(WeapName) );
format(string,sizeof(string),"Administrador (a) \"%s\" deu a todos os jogadores uma %s (%d) com %d de muniзгo", pName(playerid), WeapName, weap, ammo);
return SendClientMessageToAll(blue, string);
} else return SendClientMessage(playerid,red,"[ERRO]: Vocк nгo tem permissгo para isso");
}