/me command - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /me command (
/showthread.php?tid=182239)
/me command -
LZLo - 09.10.2010
pls help me
i want to do a
* LZLo [text] command
for example, when i write /me have drunked
send to all players: MYNAME have drunked!
THX
Re: /me command -
Las Venturas CNR - 09.10.2010
pawn Код:
if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
SendClientMessageToAll(0xFFFF00AA, str);
return 1;
}
This forum requires that you wait 120 seconds between posts. Please try again in 26 seconds.
Re: /me command -
LarzI - 09.10.2010
zcmd:
pawn Код:
CMD:me(playerid, p[])
{
if( isnull( p ))
return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
new
szMsg[ 128 ];
GetPlayerName( playerid, szMsg, sizeof( szMsg ));
format( szMsg, sizeof( szMsg ), "* %s %s", szMsg, p );
return SendClientMessageToAll( 0xFFFF00FF, szMsg );
}
Re: /me command -
LZLo - 09.10.2010
big thx man!
Re: /me command -
Bumbis - 09.10.2010
pawn Код:
if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInRangeOfPoint(i,20.0,X,Y,Z))
{
SendClientMessage(i,0xAFAFAFAA,str);
return 1;
}
}
return 1;
}
Re: /me command -
Las Venturas CNR - 09.10.2010
Quote:
Originally Posted by silvis123
pawn Код:
if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me { if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]"); new str[128]; GetPlayerName(playerid, str, sizeof(str)); format(str, sizeof(str), "* %s %s", str, cmdtext[4]); new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid,X,Y,Z); for(new i=0;i<MAX_PLAYERS;i++) { if(IsPlayerInRangeOfPoint(i,20.0,X,Y,Z)) { SendClientMessage(i,0xAFAFAFAA,str); return 1; } } return 1; }
|
Roleplay version I believe.
Re: /me command -
Rapgangsta - 09.10.2010
Quote:
Originally Posted by silvis123
pawn Код:
if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me { if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]"); new str[128]; GetPlayerName(playerid, str, sizeof(str)); format(str, sizeof(str), "* %s %s", str, cmdtext[4]); new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid,X,Y,Z); for(new i=0;i<MAX_PLAYERS;i++) { if(IsPlayerInRangeOfPoint(i,20.0,X,Y,Z)) //find in range of point { SendClientMessage(i,0xAFAFAFAA,str);//send message return 1;//stop the loop } } return 1; }
|
so its stop the loop if find anyone in range of point
must is
pawn Код:
if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInRangeOfPoint(i,20.0,X,Y,Z))//find in range of point
{
SendClientMessage(i,0xAFAFAFAA,str);//send message
}//make the loop again...
}
return 1;
}
Re: /me command -
Bumbis - 09.10.2010
I thought that return 0; will end the loop.