Add /me in Zcmd?
#1

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

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

Ok Jafet i do.
Reply
#4

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

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

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;

Reply
#7

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)