/me command - ColdIce - 21.06.2011
I want a command that works like /me is tired and it shows *ColdIce is tired
Will this work?
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/me", true, 3))
{
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;
}
return 0;
}
Re: /me command -
Wesley221 - 21.06.2011
Since it's copied from the wiki, i should work
Re: /me command -
Basicz - 21.06.2011
pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
if ( !strcmp( cmdtext, "/me", true, 3 ) )
{
if ( cmdtext[ 3 ] != ' ' || cmdtext[ 4 ] )
{
return SendClientMessage( playerid, 0xFFFFFFAA, "/me < action >" );
}
else
{
new
szStr[ 128 ],
pName[ 24 ]
;
GetPlayerName( playerid, pName, sizeof pName );
format( szStr, sizeof szStr, "* %s %s", pName, szStr );
SendClientMessageToAll( 0xFFFFFFAA, szStr );
}
return 1;
}
return 0;
}
I think something like that will works
Re: /me command - ColdIce - 21.06.2011
Neither works. Basicz: It compiled with one warning, and when I did /me is trying a new command on server, it says "me <usage>"
Re: /me command -
Wesley221 - 21.06.2011
pawn Код:
COMMAND:me(playerid, cmdtext)
{
new name[24], string[128];
if(sscanf(cmdtext, "s[128]", cmdtext)) return SendClientMessage(playerid, 0xFFFFFFAA, "/me <action>");
GetPlayerName(playerid, name, 24);
format(string, sizeof(string), "* %s %s ", name, cmdtext);
SendClientMessageToAll(0xFFFFFFAA, string);
return 1;
}
This should work, you need ZCMD & SSCANF2
Re: /me command - ColdIce - 21.06.2011
How do I use ZCMD? :/ Never used it
Re: /me command -
RoleplayEditor - 21.06.2011
huh get zcmd include simple ?
Re: /me command - ColdIce - 21.06.2011
Ahh, cant I do this simpler?
Re: /me command - ColdIce - 21.06.2011
pawn Код:
if(strcmp(cmd, "/me", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet !");
return 1;
}
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
return 1;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /me [action]");
return 1;
}
if(PlayerInfo[playerid][pAdminDuty] == 1)
{
format(string, sizeof(string), "* Admin %s", result);
}
if(PlayerInfo[playerid][pMaskuse] == 1 && PlayerInfo[playerid][pAdminDuty] == 0)
{
format(string, sizeof(string), "* Stranger %s", result);
}
if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 0)
{
format(string, sizeof(string), "* %s %s", sendername, result);
}
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] [/ME] %s: %s",d,m,y,h,mi,s,sendername,giveplayer, result);
ActionLog(string);
}
return 1;
}
Took this from Raven's RP
Needs some changing so it will work in my GM right?