sscanf2 totally bugged?
#1

Hey guys, today I was scripting my admin system, it was all OK except the ID 0 bug, so I tried to put an NPC at ID 0, and it worked!
But I found the new version of sscanf (I think I got it but no) it was the 2.8.1, I installed it but then when I joined the server (I resetted the GMX) every command was bugged! (of admin system)
I explain you the problem with a Before and After the new version:

Goto Command:

Before:
/goto was working good without ID 0 (it work but in the chat the array %s is counted by ID 0 but it worked normally))
After:
/goto wasn't working good! I tried /goto 2 (my friend) and It teleport me under the default spawn point (the center of the map SA) with my custom message "You have been teleported to npctest" OMG npctest is ID 0! Not 2!

Kick Command:
Before:
/kick was working good!
After:
/kick give me this message: "USAGE: /ban [ID] [Reason]" I don't want a Ban command! If I try /ban it give me a SERVER: Unknown command, wtf is happened? same if I try /kick 2 test .-.

Any help?
Reply
#2

Show the script buddy
Reply
#3

Ok, I used "(unformat(params ...) and (sscanf(params ...)
Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <YSI\y_ini>

#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4

#define PATH "/Users/%s.ini"

#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Total Admin by TheLorizz Loaded");
	print("--------------------------------------\n");
}
#endif

enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
    pVip,
    pFreezed,
    pWarn
}
new PlayerInfo[MAX_PLAYERS][pInfo];

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Vip",PlayerInfo[playerid][pVip]);
    INI_Int("Freezed",PlayerInfo[playerid][pFreezed]);
    INI_Int("Warn",PlayerInfo[playerid][pWarn]);
    return 1;
}

stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}

PlaySoundForAll(sound)
{
	for (new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i)) PlayerPlaySound(i,sound,0,0,0);
	}
}
/*Credits to Dracoblue*/
stock udb_hash(buf[]) {
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}

public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Scrivi la tua password per loggarti.","Login","Esci");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registrando...",""COL_WHITE"Scrivi una password per registrarti.","Registrati","Esci");
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registrando...",""COL_RED"Hai inserito una password sbagliata!\n"COL_WHITE"Scrivi una password per registrarti.","Registrati","Esci");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Vip",0);
                INI_WriteInt(File,"Freezed",0);
                INI_WriteInt(File,"Warn",0);
                INI_Close(File);
                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Completato!",""COL_GREEN"Ti sei registrato al server!. Rilogga per giocare!","Ok","");
            }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Completato!",""COL_GREEN"Ti sei loggato!!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"Hai inserito una password sbagliata!\n"COL_WHITE"Scrivi una password per loggarti.","Login","Esci");
                }
                return 1;
            }
        }
    }
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Vip",PlayerInfo[playerid][pVip]);
    INI_WriteInt(File,"Freezed",PlayerInfo[playerid][pFreezed]);
    INI_WriteInt(File,"Warn",PlayerInfo[playerid][pWarn]);
    INI_Close(File);
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerInfo[killerid][pKills]++;
    PlayerInfo[playerid][pDeaths]++;
    return 1;
}
//Level 6
CMD:setadmin(playerid, params[])
{
	new ID;
	new pn[MAX_PLAYER_NAME];
	new str[128];
	new level;
	GetPlayerName(ID, pn, MAX_PLAYER_NAME);
	if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You need to be atleast FOUNDER (6) to use this command!");
	if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not connected!");
	if(unformat(params, "ui", ID, level)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /setadmin [ID] [Level]");
	if(ID == playerid) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You can't use this command on you!");
	if(PlayerInfo[ID][pAdmin] == level) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: This player has already got this level!");
	if(level > 6 || level < 0) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Levels <0-6>");
	if(level > PlayerInfo[ID][pAdmin])
	{
	    format(str, sizeof(str), "{FFFFFF}%s {00FF00}has been promoted!", pn);
	    SendClientMessageToAll(0xFFFFFFAA, str);
	    GameTextForPlayer(ID, "{00FF00}PROMOTED!", 2500, 3);
	    PlayerPlaySound(ID, 1150, 0, 0, 0);
	    PlayerInfo[ID][pAdmin] = level;
	    return 1;
	}
	if(level < PlayerInfo[ID][pAdmin])
	{
	    format(str, sizeof(str), "{FFFFFF}%s {FF0000}has been demoted!", pn);
	    SendClientMessageToAll(0xFFFFFFAA, str);
	    GameTextForPlayer(ID, "{FF0000}DEMOTED!", 2500, 3);
	    PlayerPlaySound(ID, 1150, 0, 0, 0);
	    PlayerInfo[ID][pAdmin] = level;
		return 1;
	}
	return 1;
}
CMD:setvip(playerid, params[])
{
	new ID;
	new pn[MAX_PLAYER_NAME];
	new str[128];
	new level;
	GetPlayerName(ID, pn, MAX_PLAYER_NAME);
	if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You need to be atleast FOUNDER (6) to use this command!");
	if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not connected!");
	if(unformat(params, "ui", ID, level)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /setvip [ID] [Level]");
	if(PlayerInfo[ID][pVip] == level) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: This player has already got this level!");
	if(level > 3 || level < 0) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Levels <0-3>");
	if(level > PlayerInfo[ID][pVip])
	{
	    format(str, sizeof(str), "{FFFFFF}%s {00FF00}has been vip-promoted!", pn);
	    SendClientMessageToAll(0xFFFFFFAA, str);
	    GameTextForPlayer(ID, "VIP-PROMOTED!", 2500, 3);
	    PlayerPlaySound(ID, 1054, 0, 0, 0);
	    PlayerInfo[ID][pVip] = level;
	    return 1;
	}
	if(level < PlayerInfo[ID][pVip])
	{
	    format(str, sizeof(str), "{FFFFFF}%s {FF0000}has been vip-demoted!", pn);
	    SendClientMessageToAll(0xFFFFFFAA, str);
	    GameTextForPlayer(ID, "VIP-DEMOTED!", 2500, 3);
	    PlayerPlaySound(ID, 1055, 0, 0, 0);
	    PlayerInfo[ID][pVip] = level;
		return 1;
	}
	return 1;
}
//Level 5
CMD:ban(playerid, params[])
{
	new ID;
	new pn[MAX_PLAYER_NAME];
	new an[MAX_PLAYER_NAME];
	new str[128];
	new reason[128];
	GetPlayerName(ID, pn, MAX_PLAYER_NAME);
	GetPlayerName(playerid, an, MAX_PLAYER_NAME);
	if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You need to be atleast SUPER ADMIN (5) to use this command!");
	if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not connected!");
	if(unformat(params, "us[128]", ID, reason)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /ban [ID] [Reason]");
	if(ID == playerid) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You can't ban yourself!");
	if(PlayerInfo[ID][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You can't ban admins that have a level higher than yours!");
	format(str, sizeof(str), "{FFFFFF}%s {FF0000}has been banned by %s! Reason: %s", pn, an, reason);
	SendClientMessageToAll(0xFFFFFFAA, str);
	format(str, sizeof(str), "{FF0000}You have been banned by {FFFFFF}%s{FF0000}! Reason: {FFFFFF}%s", an, reason);
	SendClientMessage(playerid, 0xFFFFFFAA, str);
	PlaySoundForAll(1140);
	Ban(ID);
	return 1;
}
CMD:explode(playerid, params[])
{
	new ID;
	new Float:x;
	new Float:y;
	new Float:z;
	if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You need to be atleast SUPER ADMIN (5) to use this command!");
	if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not connected!");
	if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /explode [ID]");
	if(ID == playerid) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You can't explode yourself!");
	if(PlayerInfo[ID][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You can't explode admins that have a level higher than yours!");
	GetPlayerPos(ID, x, y, z);
	CreateExplosion(x, y, z, 0, 5);
	return 1;
}
//Level 4
CMD:kick(playerid, params[])
{
	new ID;
	new pn[MAX_PLAYER_NAME];
	new an[MAX_PLAYER_NAME];
	new str[128];
	new reason[128];
	GetPlayerName(ID, pn, MAX_PLAYER_NAME);
	GetPlayerName(playerid, an, MAX_PLAYER_NAME);
	if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You need to be atleast ADMIN (4) to use this command!");
	if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not connected!");
	if(unformat(params, "us[128]", ID, reason)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /ban [ID] [Reason]");
	if(ID == playerid) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You can't kicked yourself!");
	if(PlayerInfo[ID][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You can't kick admins that have a level higher than yours!");
	format(str, sizeof(str), "{FFFFFF}%s {FF0000}has been kicked by %s! Reason: %s", pn, an, reason);
	SendClientMessageToAll(0xFFFFFFAA, str);
	format(str, sizeof(str), "{FF0000}You have been kicked by {FFFFFF}%s{FF0000}! Reason: {FFFFFF}%s", an, reason);
	SendClientMessage(playerid, 0xFFFFFFAA, str);
	PlaySoundForAll(1141);
	Kick(ID);
	return 1;
}
CMD:freeze(playerid, params[])
{
	new ID;
	new pn[MAX_PLAYER_NAME];
	new an[MAX_PLAYER_NAME];
	new str[128];
	GetPlayerName(ID, pn, MAX_PLAYER_NAME);
	GetPlayerName(playerid, an, MAX_PLAYER_NAME);
	if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You need to be atleast ADMIN (4) to use this command!");
	if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not connected!");
	if(PlayerInfo[playerid][pFreezed] == 1) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: This player is already freezed!");
	if(unformat(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /freeze [ID]");
	if(PlayerInfo[ID][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You can't freeze admins that have a level higher than yours!");
	format(str, sizeof(str), "You have been freezed by {FFFFFF}%s", an);
	SendClientMessage(ID, 0xFF9900AA, str);
	format(str, sizeof(str), "You have freezed {FFFFFF}%s", pn);
	SendClientMessage(playerid, 0xFF9900AA, str);
	PlayerInfo[playerid][pFreezed] = 1;
	PlayerPlaySound(ID, 1055, 0, 0, 0);
	TogglePlayerControllable(ID, 0);
	return 1;
}
CMD:unfreeze(playerid, params[])
{
	new ID;
	new pn[MAX_PLAYER_NAME];
	new an[MAX_PLAYER_NAME];
	new str[128];
	GetPlayerName(ID, pn, MAX_PLAYER_NAME);
	GetPlayerName(playerid, an, MAX_PLAYER_NAME);
	if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You need to be atleast ADMIN (4) to use this command!");
	if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not connected!");
	if(PlayerInfo[playerid][pFreezed] == 0) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: This player is already unfreezed!");
	if(unformat(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /unfreeze [ID]");
	if(PlayerInfo[ID][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You can't unfreeze admins that have a level higher than yours!");
	format(str, sizeof(str), "You have been unfreezed by {FFFFFF}%s", an);
	SendClientMessage(ID, 0xFF9900AA, str);
	format(str, sizeof(str), "You have unfreezed {FFFFFF}%s", pn);
	SendClientMessage(playerid, 0xFF9900AA, str);
	PlayerInfo[playerid][pFreezed] = 0;
	PlayerPlaySound(ID, 1054, 0, 0, 0);
	TogglePlayerControllable(ID, 1);
	return 1;
}
//Level 3
CMD:slap(playerid, params[])
{
	new ID;
	new pn[MAX_PLAYER_NAME];
	new an[MAX_PLAYER_NAME];
	new health;
	new str[128];
	new Float:x;
	new Float:y;
	new Float:z;
	GetPlayerName(ID, pn, MAX_PLAYER_NAME);
	GetPlayerName(playerid, an, MAX_PLAYER_NAME);
	if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You need to be atleast MODERATOR (3) to use this command!");
	if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not connected!");
	if(unformat(params, "ui", ID, health)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /slap [ID] [HP]");
	if(health < 0 || health > 100) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Health <0-100>");
	if(PlayerInfo[ID][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You can't slap admins that have a level higher than yours!");
	format(str, sizeof(str), "{FFFFFF}%s {FF9900}has been slapped by {FFFFFF}%s{FF0000}! (HP Remains: {FF8899}%d/100)", pn, an, health);
	SendClientMessageToAll(0xFFFFFF, str);
	GetPlayerPos(ID, x, y, z);
	SetPlayerPos(ID, x+5, y, z);
	PlaySoundForAll(1190);
	SetPlayerHealth(ID, health);
	return 1;
}
CMD:get(playerid, params[])
{
	new ID;
	new ID2;
	new pn[MAX_PLAYER_NAME];
	new pn2[MAX_PLAYER_NAME];
	new str[128];
	new Float:x;
	new Float:y;
	new Float:z;
	GetPlayerName(ID, pn, MAX_PLAYER_NAME);
	GetPlayerName(ID2, pn2, MAX_PLAYER_NAME);
	if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You need to be atleast MODERATOR (3) to use this command!");
	if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not connected!");
	if(ID2 == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Target player not connected!");
	if(unformat(params, "uu", ID, ID2)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /get [ID] [ToID]");
	if(ID == ID2) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You can't teleport a player at the same player!");
	format(str, sizeof(str), "{FFFFFF}%s {FF9900}has been teleported to you by an admin", pn2);
	SendClientMessage(ID, 0xFFFFFFAA, str);
	format(str, sizeof(str), "{FF0000}You have been teleported to {FFFFFF}%s {FF0000}by an admin", pn);
	SendClientMessage(ID2, 0xFFFFFFAA, str);
	GetPlayerPos(ID, x, y, z);
	SetPlayerPos(ID2, x+1, y, z);
	return 1;
}
//Level 2
CMD:warn(playerid, params[])
{
	new ID;
	new pn[MAX_PLAYER_NAME];
	new an[MAX_PLAYER_NAME];
	new str[128];
	new reason[128];
	GetPlayerName(ID, pn, MAX_PLAYER_NAME);
	GetPlayerName(playerid, an, MAX_PLAYER_NAME);
	if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You need to be atleast HELPER (2) to use this command!");
	if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not connected!");
	if(unformat(params, "us[128]", ID, reason)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /warn [ID] [Reason]");
	if(ID == playerid) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not connected!");
	if(PlayerInfo[ID][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You can't warn admins with a higher level than yours!");
	if(PlayerInfo[ID][pWarn] == 0)
	{
	    format(str, sizeof(str), "{FFFFFF}%s {FF0000}has been warned by {FFFFFF}%s{FF0000}!(1/3) Reason: {FF9900}%s", pn, an, reason);
	    SendClientMessageToAll(0xFFFFFFAA, str);
	    PlayerInfo[playerid][pWarn] = 1;
	    return 1;
	}
	if(PlayerInfo[ID][pWarn] == 1)
	{
	    format(str, sizeof(str), "{FFFFFF}%s {FF0000}has been warned by {FFFFFF}%s{FF0000}!(2/3) Reason: {FF9900}%s", pn, an, reason);
	    SendClientMessageToAll(0xFFFFFFAA, str);
	    PlayerInfo[playerid][pWarn] = 2;
	    return 1;
	}
	if(PlayerInfo[ID][pWarn] == 2)
	{
	    format(str, sizeof(str), "{FFFFFF}%s {FF0000}has been warned by {FFFFFF}%s{FF0000}!(3/3 KICKED) Reason: {FF9900}%s", pn, an, reason);
	    SendClientMessageToAll(0xFFFFFFAA, str);
	    PlayerInfo[playerid][pWarn] = 0;
	    Kick(ID);
	    return 1;
	}
	return 1;
}
CMD:gethere(playerid, params[])
{
    new ID;
	new pn[MAX_PLAYER_NAME];
	new an[MAX_PLAYER_NAME];
	new str[128];
	new Float:x;
	new Float:y;
	new Float:z;
	GetPlayerName(ID, pn, MAX_PLAYER_NAME);
	GetPlayerName(playerid, an, MAX_PLAYER_NAME);
	if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You need to be atleast HELPER (2) to use this command!");
	if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not connected!");
	if(unformat(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /gethere [ID]");
	if(ID == playerid) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You can't get yourself to yourself!");
	format(str, sizeof(str), "{FF0000}Admin{FFFFFF}%s {FF9900}has teleported you to him", an);
	SendClientMessage(ID, 0xFFFFFFAA, str);
	format(str, sizeof(str), "{FF0000}You have teleported {FFFFFF}%s to you", pn);
	SendClientMessage(playerid, 0xFFFFFFAA, str);
	GetPlayerPos(playerid, x, y, z);
	SetPlayerPos(ID, x+1, y, z);
	return 1;
}
//Level 1
CMD:goto(playerid, params[])
{
    new ID;
	new pn[MAX_PLAYER_NAME];
	new an[MAX_PLAYER_NAME];
	new str[128];
	new Float:x;
	new Float:y;
	new Float:z;
	GetPlayerName(ID, pn, MAX_PLAYER_NAME);
	GetPlayerName(playerid, an, MAX_PLAYER_NAME);
	if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You need to be atleast TRUSTED PLAYER (1) to use this command!");
	if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not connected!");
	if(unformat(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /goto [ID]");
	if(ID == playerid) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You can't go to yourself!");
	format(str, sizeof(str), "{FF0000}Admin{FFFFFF}%s {FF9900}has been teleported to you", an);
	SendClientMessage(ID, 0xFFFFFFAA, str);
	format(str, sizeof(str), "{FF0000}You have been teleported to {FFFFFF}%s", pn);
	SendClientMessage(playerid, 0xFFFFFFAA, str);
	GetPlayerPos(ID, x, y, z);
	SetPlayerPos(playerid, x+1, y, z);
	return 1;
}
CMD:akill(playerid, params[])
{
	new ID;
	new pn[MAX_PLAYER_NAME];
	new an[MAX_PLAYER_NAME];
	new str[128];
	GetPlayerName(ID, pn, MAX_PLAYER_NAME);
	GetPlayerName(playerid, an, MAX_PLAYER_NAME);
	if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You need to be atleast TRUSTED PLAYER (1) to use this command!");
    if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not connected!");
	if(unformat(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /akill [ID]");
	if(ID == playerid) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You can't admin-kill yourself!");
	format(str, sizeof(str), "{FF0000}Admin {FFFFFF}%s {FF0000}has admin-killed {FFFFFF}%s{FF0000}!", an, pn);
	SendClientMessageToAll(0xFFFFFFAA, str);
	SetPlayerHealth(ID, 0);
	return 1;
}
CMD:acmds(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You need to be atleast TRUSTED PLAYER (1) to use this command!");
	if(PlayerInfo[playerid][pAdmin] > 0) return SendClientMessage(playerid, 0x00FFFFAA, "TRUSTED PLAYER (1): /akill /goto");
	if(PlayerInfo[playerid][pAdmin] > 0) return SendClientMessage(playerid, 0x00FFFFAA, "HELPER (2): /gethere /warn");
	if(PlayerInfo[playerid][pAdmin] > 0) return SendClientMessage(playerid, 0x00FFFFAA, "MODERATOR (3): /get /slap");
	if(PlayerInfo[playerid][pAdmin] > 0) return SendClientMessage(playerid, 0x00FFFFAA, "ADMIN (4): /unfreeze /freeze /kick");
	if(PlayerInfo[playerid][pAdmin] > 0) return SendClientMessage(playerid, 0x00FFFFAA, "SUPER ADMIN (5): /explode /ban");
    if(PlayerInfo[playerid][pAdmin] > 0) return SendClientMessage(playerid, 0x00FFFFAA, "FOUNDER (6): /setadmin /setvip");
    return 1;
}
Ah, how to fix acmds? I don't remember, I want that if a player is Level 1 is says only the Level 1 messages, but if it's level 2 it says the level 1 and level 2 messages, any help? xD
Reply
#4

what do you mean? For example 1 CMD = Level 1 player can only use this command? is that what are you trying to saY?
Reply
#5

no, if a Level 1 says /acmds it shows only the command for Level 1
and if a Level 2 says /acmds it shows the command for Level 1 and 2
I know how to give permissions to every level :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)