Need help with my commands
#3

Quote:
Originally Posted by oliverrud
Посмотреть сообщение
Код:
IRCCMD:sethealth(botid, channel[], user[], host[], params[])
{
	if (IRC_IsVoice(botid, channel, user))
	{
	    new playerid, Float:amount; //Line 477
	    if (sscanf(params, "uf", playerid, amount)) return 1;
	if (IsPlayerConnected(playerid))
		{
		    new msg[128], name[MAX_PLAYER_NAME];
		    GetPlayerName(playerid, name, sizeof(name));
		    format(msg, sizeof(msg), "%s has set %s health to %.2f", user, name, amount);
		    IRC_GroupSay(groupID, channel, msg);
		    format(msg,sizeof(msg), "%s has set %s health to %.2f", user, name, amount);
		    SendClientMessageToAll(0xDDDD2357, msg);
		    SetPlayerHealth(playerid, amount); //Maybe Correct   EDIT: Not working
		}
	}
	return 1;
}
This should work, what I've done is switched the amount variable to a float instead of a string, since health and armor values are handled in floats.
Also changed the d inside the sscanf to a 'u', which allows to select playerids by either their id or part of their name.
Worked, btw, what does the "u" inside the sscanf means? i thought that was only a message when they didn't put a reason or amount.....

Thanks for your help
Reply


Messages In This Thread
Need help with my commands - by YahyaBR - 28.03.2015, 06:41
Re: Need help with my commands - by oliverrud - 28.03.2015, 08:04
Re: Need help with my commands - by YahyaBR - 28.03.2015, 08:29
Re: Need help with my commands - by Juvanii - 28.03.2015, 09:11
Re: Need help with my commands - by YahyaBR - 28.03.2015, 09:33
Re: Need help with my commands - by oliverrud - 28.03.2015, 09:37
Re: Need help with my commands - by Juvanii - 28.03.2015, 09:49
Re: Need help with my commands - by JeaSon - 28.03.2015, 12:30
Re: Need help with my commands - by YahyaBR - 28.03.2015, 15:34

Forum Jump:


Users browsing this thread: 1 Guest(s)