SA-MP Forums Archive
A-Admin FilterScript 1 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: A-Admin FilterScript 1 Command (/showthread.php?tid=58833)



A-Admin FilterScript 1 Command - [SFSF]Ali - 22.12.2008

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


Re: A-Admin FilterScript 1 Command - [SFSF]Ali - 22.12.2008

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.


Re: A-Admin FilterScript 1 Command - Zezombia - 22.12.2008

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


Re: A-Admin FilterScript 1 Command - [SFSF]Ali - 22.12.2008

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


Re: A-Admin FilterScript 1 Command - [SFSF]Ali - 22.12.2008

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.


Re: A-Admin FilterScript 1 Command - Lewwy - 22.12.2008

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


Re: A-Admin FilterScript 1 Command - [SFSF]Ali - 22.12.2008

i know its stupid. its under construction


Re: A-Admin FilterScript 1 Command - Unknown1234 - 07.03.2012

hahah pro! nicely done!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!! hah pro +1 rep


Re: A-Admin FilterScript 1 Command - McCarthy - 07.03.2012

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


Re: A-Admin FilterScript 1 Command - Unknownich - 08.03.2012

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