#1

I'm trying to make it so that the player id is optional and that it defaults to yourself with sscanf. When I run the command without the player id, it doesn't give me the "Usage" output, indicating that sscanf recognizes that it's optional, but it doesn't give me the playerid.

Код:
CMD:w(playerid, params[])
{
	new weapid, recieverid, ammo;
	recieverid = playerid;
	if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAY, "You are not authorized to use that command!");
	if (sscanf(params, "diU", weapid, ammo, recieverid)) return SendClientMessage(playerid, COLOR_GRAY, "Usage: /w [weapon id] [ammo] [player id]");
	if (weapid < 0 || weapid > 46) return SendClientMessage(playerid, COLOR_GRAY, "Invalid weapon ID!");
	else
		{
		GivePlayerWeapon(recieverid, weapid, ammo);
		}
	return 1;
}
Reply


Messages In This Thread
/w - by InSain - 23.02.2018, 05:42
Re: /w - by BulletRaja - 23.02.2018, 05:58
Re: /w - by RogueDrifter - 23.02.2018, 05:59
Re: /w - by BulletRaja - 23.02.2018, 07:13
Re: /w - by rfr - 23.02.2018, 07:58
Re: /w - by RogueDrifter - 23.02.2018, 08:00
Re: /w - by rfr - 23.02.2018, 08:02
Re: /w - by Kane - 23.02.2018, 08:10
Re: /w - by Stev - 23.02.2018, 08:16
Re: /w - by kingmk - 23.02.2018, 11:34

Forum Jump:


Users browsing this thread: 1 Guest(s)