SA-MP Forums Archive
set admin command - 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: set admin command (/showthread.php?tid=590983)



set admin command - xXDuno2000ManXx - 06.10.2015

Hello i need very easy /setadmin command using strcmp.



Re: set admin command - Crystallize - 06.10.2015

Код:
if(strcmp(cmd, "/makeadmin", true) == 0) 
    { 
        if(IsPlayerConnected(playerid)) 
        { 
            if(PlayerInfo[playerid][pAdmin] >= 1) 
            { 
                new idx; 
                tmp = strtok(cmdtext, idx); 
                if(!strlen(tmp)) 
                { 
                    SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level]"); 
                    return 1; 
                } 
                new para1; 
                new level; 
                new tmp[256]; 
                new giveplayer[MAX_PLAYER_NAME]; 
                para1 = ReturnUser(tmp); 
                tmp = strtok(cmdtext, idx); 
                level = strval(tmp); 
                if(IsPlayerConnected(para1)) 
                { 
                    if(para1 != INVALID_PLAYER_ID) 
                    { 
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer)); 
                        GetPlayerName(playerid, sendername, sizeof(sendername)); 
                        PlayerInfo[para1][pAdmin] = level; 
                        printf("Info: %s has promoted %s to a level %d admin.", sendername, giveplayer, level); 
                        format(string, sizeof(string), "   You have been promoted to a level %d admin by %s", level, sendername); 
                        SendClientMessage(para1, COLOR_LIGHTBLUE, string); 
                        format(string, sizeof(string), "   You have promoted %s to a level %d admin.", giveplayer,level); 
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string); 
                    } 
                } 
            } 
        } 
        return 1; 
    }
Idk why you are using strcmp , you have better command processors like zcmd
Replace the admin variable with yours


Re: set admin command - Vince - 06.10.2015

Quote:
Originally Posted by Wizzard2H
Посмотреть сообщение
Idk why you are using strcmp , you have better command processors like zcmd
Speech is silver, silence is golden. Don't bother teaching outdated methods.