SA-MP Forums Archive
how to make /me - 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: how to make /me (/showthread.php?tid=596241)



how to make /me - NourNN - 14.12.2015

Hi All This My First Time In This Forum Dont Insult Plz Iam begginer

how to make /me


Quote:

//first you need includes
#include <zcmd>
#include <sscanf2>

About /me

Quote:

CMD:me(playerid,params[])
{
new text, string[123];
if(sscanf(params,"sd",text)) return SendClientMessage(playerid,0xEBFF00FF,"USAGE: /me [Text]");
format(string,sizeof(string),"*%s %s",pName(playerid),text);
SendClientMessageToAll(0xFF00E1FF,string);
return 1;
}

And Thanks if i helped you +rep


Re: how to make /me - TwinkiDaBoss - 14.12.2015

Quote:
Originally Posted by NourNN
Посмотреть сообщение
Hi All This My First Time In This Forum Dont Insult Plz Iam begginer

how to make /me




About /me




And Thanks if i helped you +rep
First of all this is script help thread, not tutorials thread.

And the problem with your code is .
PHP код:
CMD:me(playerid,params[])
{
    new 
text[128], string[128];
    if(
sscanf(params,"s[128]",text)) return SendClientMessage(playerid,0xEBFF00FF,"USAGE: /me [Text]");
    
format(string,sizeof(string),"*%s %s",pName(playerid),text);
    
SendClientMessageToAll(0xFF00E1FF,string);
    return 
1;

sscanf must include string size, also there is no need for "d" in it, you are not looking for any intergrers. Also your "text" wasnt set to string size


Re: how to make /me - TheSnaKe - 14.12.2015

Post here for tutorials http://forum.sa-mp.com/forumdisplay.php?f=70


Re: how to make /me - CrazyPerry - 15.12.2015

Код:
CMD:me(playerid,params[])
{
new text, string[123];
if(sscanf(params,"sd",text)) return SendClientMessage(playerid,0xEBFF00FF,"USAGE: /me [Text]");
format(string, sizeof(string), "%s (%d): %s",pName,playerid,text);
SendClientMessageToAll(GetPlayerColor(playerid), string);
return 1;
}
try this bro


Re: how to make /me - TwinkiDaBoss - 15.12.2015

Quote:
Originally Posted by CrazyPerry
Посмотреть сообщение
Код:
CMD:me(playerid,params[])
{
new text, string[123];
if(sscanf(params,"sd",text)) return SendClientMessage(playerid,0xEBFF00FF,"USAGE: /me [Text]");
format(string, sizeof(string), "%s (%d): %s",pName,playerid,text);
SendClientMessageToAll(GetPlayerColor(playerid), string);
return 1;
}
try this bro
I dont even see that you changed something. Text is still recognized as Int as you havent set the size or anything to it, also parameters in sscanf are SD, what is "d" for? Please, just look at my code which works.


Re: how to make /me - SoFahim - 15.12.2015

Quote:
Originally Posted by TheSnaKe
Посмотреть сообщение
-_- That for whome who give tutorial to others. Not for ask -_- World of idiot


Re: how to make /me - Beckett - 15.12.2015

Have a look at this.


Re: how to make /me - NourNN - 15.12.2015

Quote:

CMD:me(playerid,params[])
{
new text, string[123];
if(sscanf(params,"sd",text)) return SendClientMessage(playerid,0xEBFF00FF,"USAGE: /me [Text]");
format(string, sizeof(string), "%s (%d): %s",pName,playerid,text);
SendClientMessageToAll(GetPlayerColor(playerid), string);
return 1;
}

try this bro

thank you btw


Re: how to make /me - N0FeaR - 15.12.2015

This guy just want reps lol.


Re: how to make /me - Stinged - 15.12.2015

Quote:
Originally Posted by TwinkiDaBoss
Посмотреть сообщение
First of all this is script help thread, not tutorials thread.

And the problem with your code is .
PHP код:
CMD:me(playerid,params[])
{
new 
text[128], string[128];
if(
sscanf(params,"s[128]",text)) return SendClientMessage(playerid,0xEBFF00FF,"USAGE: /me [Text]");
format(string,sizeof(string),"*%s %s",pName(playerid),text);
SendClientMessageToAll(0xFF00E1FF,string);
return 
1;

sscanf must include string size, also there is no need for "d" in it, you are not looking for any intergrers. Also your "text" wasnt set to string size
There's no need for sscanf here.
ZCMD has "params", which is what you write after the command.

You use sscanf to split or change those params.
Since 'params' is a string, you can easlily do this instead:

pawn Код:
if (isnull(params)) return SendClientMessage(playerid,0xEBFF00FF,"USAGE: /me [Text]");
format(string,sizeof(string),"*%s %s", pName(playerid), params);
SendClientMessageToAll(0xFF00E1FF, params);
return 1;