ammo problem
#1

to the server " /giveallweapon 29 100 " 0 rounds gives giving ammo false what should I do command recovers
where there is error? can you help please

Код:
dcmd_giveallweapon(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 6) {
	    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, "USAGE: /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");
      	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),"Administrator \"%s\" has given all players a %s (%d) with %d rounds of ammo", pName(playerid), WeapName, weap, ammo);
		return SendClientMessageToAll(blue, string);
	} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
Reply
#2

Say hello to Fred Flintstone. I mean, come on, who still uses dcmd and all this tmp bullshit if you can just use sscanf (https://sampforum.blast.hk/showthread.php?tid=173994)

And I'm not sure whether I understood the question. You mean that when you type the command, it gives 0 ammo?
Reply
#3

" sscanf " I add meliorate?
Reply
#4

Quote:
Originally Posted by Rifa4life
Посмотреть сообщение
Say hello to Fred Flintstone. I mean, come on, who still uses dcmd and all this tmp bullshit if you can just use sscanf (https://sampforum.blast.hk/showthread.php?tid=173994)

And I'm not sure whether I understood the question. You mean that when you type the command, it gives 0 ammo?
sscanf plugins I've added did not improve
Reply
#5

sscanf works much better
Reply
#6

Quote:
Originally Posted by FallweN
Посмотреть сообщение
sscanf works much better
- I'm giving 100 rounds /giveallweapon 29 100
- 0 rounds gives
- damaged ammo
- code of what I do
- I do meliorate

Код:
if(!strlen(tmp2) || !IsNumeric(tmp2) || strval(tmp2) <= 0 || strval(tmp2) > 99999) ammo = 500;
Reply
#7

How to resolve this problem?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)