SA-MP Forums Archive
helpme problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: helpme problem (/showthread.php?tid=497396)



helpme problem - AhmedMohamed - 26.02.2014

It doesn't work
Код:
CMD:helpme(playerid, params[])
{
	new str[128], Name1[MAX_PLAYER_NAME];
	if(sscanf(params,"s[128]", str))
	{
	 SendClientMessage(playerid, red,"CORRECT USAGE: /helpme [text]");
	 return 1;
	}
	GetPlayerName(playerid, Name1, sizeof(Name1));
	format(str, sizeof(str),"{00FFFF}[HELP MSG From %s]:{00FFF0} %s",Name1, str);
	MessageToTwice(red, str);
	SendClientMessage(playerid, yellow,"Your Request has been sent to online Administrators.");
	return 1;
}



Respuesta: helpme problem - CuervO - 26.02.2014

What does exactly not work? What is it supposed to do and what does it do instead? The command itself has no fail.


Re: helpme problem - AhmedMohamed - 26.02.2014

this command doesn't work when i type it, send to me the client message : CORRECT USAGE: /helpme [text].


Re: helpme problem - Aerotactics - 26.02.2014

I've never used sscanf myself, but shouldn't you define "s[128]" to "s[8]" or something? However long the minimum string length is?


Re: helpme problem - MattTucker - 27.02.2014

pawn Код:
if(sscanf(params,"s[128]", str))
Instead of 'str' you can try and change it with 'params'.


Re: helpme problem - Dubya - 27.02.2014

You're problem is in your string. You're reformating the string.
Try something like this:
pawn Код:
CMD:helpme(playerid, params[])
{
    new str[128], text[56] Name1[MAX_PLAYER_NAME];
    if(sscanf(params,"s[56]", text))
    {
     SendClientMessage(playerid, red,"CORRECT USAGE: /helpme [text]");
     return 1;
    }
    GetPlayerName(playerid, Name1, sizeof(Name1));
        // In the line below, you were formatting the 'str' variable which was used in the sscanf sentence.
    format(str, sizeof(str),"{00FFFF}[HELP MSG From %s]:{00FFF0} %s",Name1, text);
    MessageToTwice(red, str);
    SendClientMessage(playerid, yellow,"Your Request has been sent to online Administrators.");
    return 1;
}



Re: helpme problem - Threshold - 27.02.2014

pawn Код:
MessageToTwice(red, str);
This is the problem then.


Re: helpme problem - AhmedMohamed - 27.02.2014

REP + ALL TY