/makeadmin commad
#1

Hey guys i'v looked all over ****** every where, and i can't find a WORKING
/makeadmin command, maybe you guys can create a simple /makeadmin command
I mean nothing advanced, just a simple /makeadmin command.
but.. not DCMD or ZCMD and all that, i'd like it to be smth like that idk how it's called

if (strcmp(cmdtext, "/makeadmin", true) == 0)

and so on.. thank you guys
Reply
#2

Do you got an admin script?
Reply
#3

Quote:
Originally Posted by Pinguinn
Посмотреть сообщение
Do you got an admin script?
admin script... no not really, but i have a login and register dialog

i have a /admins command

and i have /aduty, so i think yea.
Reply
#4

pawn Код:
if(strcmp(cmd, "/makeadmin", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level]");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 10)
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        GiveNameSpace(sendername);
                        GiveNameSpace(giveplayer);
                        if(PlayerInfo[playerid][pAdmin] == 11) { sendername = "Hidden Admin"; }
                        new Float:shealth;
                        GetPlayerHealth(para1,shealth);
                        SetPlayerHealthEx(para1,shealth);
                        new Float:darmour;
                        GetPlayerArmour(para1,darmour);
                        SetPlayerArmourEx(para1,darmour);
                        PlayerInfo[para1][pAdmin] = level;
                        //printf("AdmCmd: %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_WHITE, string);
                        format(string, sizeof(string), "   You have promoted %s to a level %d admin.", giveplayer,level);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        format(string, sizeof(string), "[ID: %d]  %s has promoted %s [ID: %d] to a level %d admin.", playerid, sendername, giveplayer, para1,level);
                        ABroadCast(COLOR_YELLOW, string, 1);
                        printf("%s", string);

                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command!");
            }
        }
        return 1;
    }
Reply
#5

You must have an Administration system but very least a Registration System, search over Filterscripts Section or Tutorials. Samp wiki can show you HOW to make an Administration system too. wiki.sa-mp.com
Reply
#6

ahhh ty guys but Elie
i got these errors

C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(217) : error 017: undefined symbol "cmd"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(221) : error 017: undefined symbol "tmp"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(221) : error 017: undefined symbol "strtok"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(222) : error 017: undefined symbol "tmp"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(224) : error 017: undefined symbol "COLOR_GRAD2"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(229) : error 017: undefined symbol "ReturnUser"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(230) : error 017: undefined symbol "tmp"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(230) : error 017: undefined symbol "strtok"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(231) : error 017: undefined symbol "tmp"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(23 : error 017: undefined symbol "giveplayer"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(23 : error 017: undefined symbol "giveplayer"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(23 : error 029: invalid expression, assumed zero
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(23 : fatal error 107: too many error messages on one line
Reply
#7

get Sscanf
Reply
#8

Try that I hope Its work for you!!.

Код:
if(strcmp(cmd, "/makeadmin", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level]");
				return 1;
			}
			new para1;
			new level;
			para1 = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			level = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 10)
			{
			    if(IsPlayerConnected(para1))
			    {
			        if(para1 != INVALID_PLAYER_ID)
			        {
						GetPlayerName(para1, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						GiveNameSpace(sendername);
						GiveNameSpace(giveplayer);
						if(PlayerInfo[playerid][pAdmin] == 11) { sendername = "Hidden Admin"; }
						new Float:shealth;
	                    GetPlayerHealth(para1,shealth);
	                    SetPlayerHealthEx(para1,shealth);
	                    new Float:darmour;
	                    GetPlayerArmour(para1,darmour);
	                    SetPlayerArmourEx(para1,darmour);
						PlayerInfo[para1][pAdmin] = level;
						//printf("AdmCmd: %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_WHITE, string);
						format(string, sizeof(string), "   You have promoted %s to a level %d admin.", giveplayer,level);
						SendClientMessage(playerid, COLOR_WHITE, string);
						format(string, sizeof(string), "[ID: %d]  %s has promoted %s [ID: %d] to a level %d admin.", playerid, sendername, giveplayer, para1,level);
						ABroadCast(COLOR_YELLOW, string, 1);
						
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command!");
			}
		}
		return 1;
	}
Just change the level of admin here which admin level will makeadmins...
Код:
if (PlayerInfo[playerid][pAdmin] >= 10)
Just looking for Rep..
Reply
#9

Under OnPlayerCommandText add

pawn Код:
new cmd[256];
new tmp[256];
new giveplayer[MAX_PLAYER_NAME];
new string[128];
cmd = strtok(cmdtext, idx);

Under OnGamemodeInit

pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

Define :
pawn Код:
#define COLOR_GRAD2 0xBFC0C2FF
Reply
#10

now i got these errors

C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(64) : error 017: undefined symbol "strtok"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(64) : error 029: invalid expression, assumed zero
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(64) : error 017: undefined symbol "string"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(64) : fatal error 107: too many error messages on one line
Reply
#11

Quote:
Originally Posted by ThePandaDK
Посмотреть сообщение
now i got these errors

C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(64) : error 017: undefined symbol "strtok"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(64) : error 029: invalid expression, assumed zero
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(64) : error 017: undefined symbol "string"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(64) : fatal error 107: too many error messages on one line
You need to put strtok all the way down in the script
Add this in the command
pawn Код:
new string[128];
Reply
#12

Quote:
Originally Posted by ThePandaDK
Посмотреть сообщение
now i got these errors

C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(64) : error 017: undefined symbol "strtok"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(64) : error 029: invalid expression, assumed zero
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(64) : error 017: undefined symbol "string"
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(64) : fatal error 107: too many error messages on one line
Shouldn't be giving errors, may you post the things i gave you when you added em in your script ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)