SA-MP Forums Archive
Add /me in Zcmd? - 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: Add /me in Zcmd? (/showthread.php?tid=280509)



Add /me in Zcmd? - ServerScripter - 01.09.2011

Hi how to add the Command /me with zcmd ? Thanx


Re: Add /me in Zcmd? - Jafet_Macario - 01.09.2011

Click the tutorial in my signature, you have there some explanations


Re: Add /me in Zcmd? - ServerScripter - 01.09.2011

Ok Jafet i do.


Re: Add /me in Zcmd? - ServerScripter - 01.09.2011

ok i finish , but what is the relation of /heal [ID] and /me [ACTION] ?


Re: Add /me in Zcmd? - HyperZ - 01.09.2011

pawn Код:
CMD:me(playerid, params[])
{
    new name[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, name, sizeof(name));
    if(isnull(params))
        return SendClientMessage(playerid, -1,"USAGE: /me [Action]");
    format(str,sizeof(str),"*%s %s",name, params);
    SendClientMessageToAll(-1, str);
    return 1;
}



Re: Add /me in Zcmd? - Jafet_Macario - 01.09.2011

What do you mean by that? You have there an ooc command that it can be easly changed to /me if you read.
Anyway, here you go:
PHP код:
CMD:me(playeridparams[])
{
    new 
sendername[MAX_PLAYER_NAME], string[128];
    
GetPlayerName(playeridsendernamesizeof(sendername));
    if(
isnull(params)) return SendClientMessage(playerid,0xFFFFFFF,"USAGE: /me [action]");
    
format(stringsizeof(string), "*%s %s"sendernameparams);
    
SendClientMessageToAll(-1string);
    return 
1;




Re: Add /me in Zcmd? - ServerScripter - 01.09.2011

Thank you a lot Russel! and your command don't need SSCANF

but i have a question for u Jafet or other Scripters : whene can i use sscanf? it is alowed to creat other commands? Please Reply me


Re: Add /me in Zcmd? - HyperZ - 01.09.2011

Quote:
Originally Posted by ServerScripter
Посмотреть сообщение
Thank you a lot ! and your command don't need SSCANF

but i have a question : whene can i use sscanf? it is alowed to creat other commands? Please Reply me
Yes.

Sscanf2 and zcmd:
pawn Код:
CMD:heal( playerid, params[ ] )
{
    new ID;
    if(sscanf(params, "u", ID)) return SendClientMessage(playerid, -1,"Usage: /heal [PlayerID]");
    if(IsPlayerConnected(ID) && ID != INVALID_PLAYER_ID)
    {
        SetPlayerHealth(ID, 100);
    }
    else return SendClientMessage(playerid, -1, "Player is not connected or is yourself.");
    return 1;
}
CMD:me(playerid, params[])
{
    new name[MAX_PLAYER_NAME], str[128]. msg[128];
    GetPlayerName(playerid, name, sizeof(name));
    if(sscanf(params, "s[128]", msg)) return SendClientMessage(playerid, -1,"USAGE: /me [Action]");
    format(str,sizeof(str),"*%s %s",name, msg);
    SendClientMessageToAll(-1, str);
    return 1;
}
Only zcmd:
pawn Код:
CMD:heal( playerid, params[ ] )
{
    if(isnull(params))
        return SendClientMessage(playerid, -1,"USAGE: /heal [PlayerID]");
    new ID = strval(params);
    if(IsPlayerConnected(ID) && ID != INVALID_PLAYER_ID)
    {
        SetPlayerHealth(ID, 100);
    }
    else return SendClientMessage(playerid, -1,"Player is not connected or is yourself.");
    return 1;
}
CMD:me(playerid, params[])
{
    new name[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, name, sizeof(name));
    if(isnull(params))
        return SendClientMessage(playerid, -1,"USAGE: /me [Action]");
    format(str,sizeof(str),"*%s %s",name, params);
    SendClientMessageToAll(-1, str);
    return 1;
}



Re: Add /me in Zcmd? - ServerScripter - 01.09.2011

Thank you Russell_ to explain , but the SSCANF+zcmd command and Zcmd command have the same function it is right?