SA-MP Forums Archive
Convert from dcmd to strcmp [Help me] - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Convert from dcmd to strcmp [Help me] (/showthread.php?tid=221135)



Convert from dcmd to strcmp [Help me] - showarn - 04.02.2011

Hello could some1 help me convert this script for me cuz aint working;S i think the problem is "dcmd"


here is the script

Код:
#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
Код:
dcmd(wantedlvl, 9, cmdtext);
Код:
dcmd_wantedlvl(playerid, params[])
{
    if(gTeam[playerid] == TEAM_BLUE)
    {
        new targetid, wanted, reason;

        if(sscanf(params, "udz", targetid, wanted, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setwanted (id) (wanted-level) (reason)");
        else if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Invalid ID");
        else if(wanted < 7)
        {
            new playername[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], string[256];
            GetPlayerName(playerid, playername, sizeof(playername));
            GetPlayerName(targetid, targetname, sizeof(targetname));

            SetPlayerWantedLevel(targetid, wanted);
            
            format(string, sizeof(string), "%s(%d) has set your wanted to %d because %s", playername, playerid, wanted, reason);
            SendClientMessage(targetid, COLOR_LIGHTGREEN, string);
            
            format(string, sizeof(string), "You has set %s(%d) wanted to %d because %s", targetname, targetid, wanted, reason);
            SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
            return 1;
        }
        else SendClientMessage(playerid, COLOR_RED,"USAGE: Minimum 0 || Maximum 6");
        return 1;
    }
    return 0;
}
if any1 understand these terms please help me !


Re: Convert from dcmd to strcmp [Help me] - admantis - 04.02.2011

You really don't want to do it. Use dcmd and sscanf, it's like x20 easier.


Re: Convert from dcmd to strcmp [Help me] - showarn - 04.02.2011

ye but i got sscanf and this script dosnt work for me i dno why


Re: Convert from dcmd to strcmp [Help me] - r3k1lLz_ - 05.02.2011

Why would you want to change dcmd to strcmp that is the dumbest idea I've ever heard...


Re: Convert from dcmd to strcmp [Help me] - showarn - 05.02.2011

okey i dno iam learning i dont now a shit about scripting atm Readed some guides etc but aint readed bout this anything wrong with my script why dosnt it work ?


Re: Convert from dcmd to strcmp [Help me] - Unknown123 - 05.02.2011

His whole gamemode is based on "strcmp"
And when he added the "dcmd" command then the command didnt work...

I dont know the problem but..