/me command
#1

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
Reply
#2

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.
Reply
#3

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 );
}
Reply
#4

big thx man!
Reply
#5

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;
    }
Reply
#6

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.
Reply
#7

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;
    }
Reply
#8

I thought that return 0; will end the loop.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)