Strcmp > DCMD [+REP!] Fast Please
#2

Quote:
Originally Posted by [RaZ]Hal_Moore
Посмотреть сообщение
How can i make this
PHP код:
    if(strcmp(cmd"/id"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_WHITE"USAGE: /id [playerid/PartOfName]");
                return 
1;
            }
            
giveplayerid ReturnUser(tmp);
            if(
IsPlayerConnected(giveplayerid))
            {
                if(
giveplayerid != INVALID_PLAYER_ID)
                {
                    
GetPlayerNameEx(giveplayeridgiveplayersizeof(giveplayer));
                    
format(stringsizeof(string), "Name: %s, ID: %d"giveplayergiveplayerid);
                    
SendClientMessage(playeridCOLOR_GRAD1string);
                }
            }
            else
            {
                
format(stringsizeof(string), "   %d is not an active player !"giveplayerid);
                
SendClientMessage(playeridCOLOR_GRAD1string);
            }
        }
        return 
1;
    } 
DCMD? Please convert
pawn Код:
dcmd_id(playerid, params[])
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /id [playerid/PartOfName]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    GetPlayerNameEx(giveplayerid, giveplayer, sizeof(giveplayer));
                    format(string, sizeof(string), "Name: %s, ID: %d", giveplayer, giveplayerid);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                }
            }
            else
            {
                format(string, sizeof(string), "   %d is not an active player !", giveplayerid);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
        }
        return 1;
    }
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(id, 2, cmdtext);
    return 1;
}
Put this at the beginning of your script:
pawn Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Reply


Messages In This Thread
Strcmp > DCMD [+REP!] Fast Please - by Aira - 19.03.2012, 10:35
Re: Strcmp > DCMD [+REP!] Fast Please - by Mark™ - 19.03.2012, 10:39
Re: Strcmp > DCMD [+REP!] Fast Please - by Aira - 19.03.2012, 10:42
Re: Strcmp > DCMD [+REP!] Fast Please - by Mark™ - 19.03.2012, 10:44
Re: Strcmp > DCMD [+REP!] Fast Please - by Aira - 19.03.2012, 10:46
Re: Strcmp > DCMD [+REP!] Fast Please - by Mark™ - 19.03.2012, 10:47
Re: Strcmp > DCMD [+REP!] Fast Please - by Dripac - 19.03.2012, 11:02
Re: Strcmp > DCMD [+REP!] Fast Please - by Mark™ - 19.03.2012, 11:05

Forum Jump:


Users browsing this thread: 3 Guest(s)