A-Admin FilterScript 1 Command
#1

Im a begginer in filterscripting i have made only 1 command lola might become useful in the future
Code:
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/aadmin", true) == 0)
{
    new string[128];
    new tmp[256];
    new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
    new giveplayerid;
    if (IsPlayerAdmin(playerid))
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, ORANGE, "USAGE: /makeadmin [playerid] [level]");
            SendClientMessage(playerid, ORANGE, "FUNCTION: Player will be an admin.");
            return 1;
        }
        giveplayerid = ReturnUser(tmp);
        tmp = strtok(cmdtext, idx);
        new level = strval(tmp);
        if(giveplayerid != INVALID_PLAYER_ID)
        {
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, player, sizeof(player));
            PlayerInfo[giveplayerid][AdminLevel] = level;
            printf("Admin %s made %s a level %d admin.", player, giveplayer, level);
            format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level, player);
            SendClientMessage(giveplayerid, 0x00C2ECFF, string);
            format(string, sizeof(string), "You have given %s level %d admin.", giveplayer,PlayerInfo[giveplayerid][AdminLevel]);
                SendClientMessage(playerid, 0x00C2ECFF, string);
        }
        else if(giveplayerid == INVALID_PLAYER_ID)
        {
            format(string, sizeof(string), "%i is not an active player.", giveplayerid);
            SendClientMessage(playerid, 0xE60000FF, string);
        }
    }
    else
    {
      SendClientMessage(playerid, 0xE60000FF, "You are not a lead admin!");
    }
    return 1;
}
note the "/aadmin", command i renamed it to that so the people who want to become admin cant fool begginer admins to type /makeadmin id level. Note: im a begginer dont become stressed ok? bcuz this is under construction :P
Reply
#2

make sure this is present:
Code:
OnPlayerConnect(playerid)
{
  PlayerInfo[playerid][AdminLevel] = 0;
  return 1;
}
orelse when the player will connect he will be the admin level.
Reply
#3

Lmao Ali, maybe this can help: https://sampwiki.blast.hk/wiki/zcmd
Reply
#4

Quote:
Originally Posted by Cueball2
Lmao Ali, maybe this can help: https://sampwiki.blast.hk/wiki/zcmd
thanx man i appreciate it
Reply
#5

lola new command released
Code:
if(strcmp("/gfh", cmdtext, true, 5) == 0) //normal command - unfortunately, the cellmax is needed
	{
		new tmp[128]; //create a tmp, just like strtok
		tmp = zcmd(1, cmdtext); //the "1" is the position of the var - see next example
 
		if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "You did not add an ID"); //check string length, just like strtok
 
		Kick(strval(tmp)); //kick the value of the tmp string
		return 1;
	}
i made a new cmd /gfh it means go from here. i just changed the cmd so that normal players couldnt fool begginer admins.
Reply
#6

Quote:
Originally Posted by [SFSF
Ali ]
pawn Code:
new cmd[256]
Edit strtok so you can make the array 128.
Reply
#7

i know its stupid. its under construction
Reply
#8

hahah pro! nicely done!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!! hah pro +1 rep
Reply
#9

I'm not even going to bother saying anything to you Unknown, since you are here just to troll
Reply
#10

So what is the plan for version 2.0, 2 commands?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)