SA-MP Forums Archive
Need help for a CMD (adminlevel) [++Rep] - 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: Need help for a CMD (adminlevel) [++Rep] (/showthread.php?tid=320748)



Need help for a CMD (adminlevel) [++Rep] - Amine_Mejrhirrou - 24.02.2012

Код:
CMD:adminlevel(playerid, params[])
{
	if(PlayerMuted[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "[SERVER PROTECTION] You are muted!");
	if(GetAdminLevel(playerid) >= 5|| IsPlayerAdmin(playerid)) {
		new reason[10], giveplayerid, sendername[24], str[128], str2[128], PlayerName[24], file[128];
		if(sscanf(params, "ui", giveplayerid,reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /adminlevel [playerid] [1-5]");
		if(!IsPlayerConnected(giveplayerid)) return 1;
		GetPlayerName(playerid, sendername, 20);
		GetPlayerName(giveplayerid, PlayerName, sizeof(PlayerName));
		format(file, 128, USER_FILE, PlayerName);
		dini_Set(file, "AdminLevel",reason);
		format(str, 128, "You have set the admin level of %s to %d!", PlayerName, reason);
		format(str2, 128, "You have been Ranked up (Admin team) %d. use /ahelp for info", reason);
		SendClientMessage(playerid, COLOR_RED, str);
		SendClientMessage(giveplayerid, COLOR_RED, str2);
	}
	if(GetAdminLevel(playerid) ==0)
	{
	    SendClientMessage(playerid, COLOR_WHITE, "[SYSTEM] You are not an admin");
	}
	return 1;
}
When i use it it say that the player has been rankedup but it's not true and i still don't finde the error ! i know that it's something in relation with the Dini_Set but i need your help


AW: Need help for a CMD (adminlevel) [++Rep] - Drebin - 24.02.2012

Use dini_IntSet instead of dini_Set. (since you are saving an integer, not a string).
Also use
pawn Код:
new reason;
instead of
pawn Код:
new reason[10];
since the admin level is a number, not a word.


Re : Need help for a CMD (adminlevel) [++Rep] - Amine_Mejrhirrou - 24.02.2012

it gives me an error
error 035: argument type mismatch (argument 3)


Re: AW: Need help for a CMD (adminlevel) [++Rep] - Vince - 24.02.2012

Quote:
Originally Posted by Drebin
Посмотреть сообщение
Use dini_IntSet instead of dini_Set.
^ (4 char)


Re : Re: AW: Need help for a CMD (adminlevel) [++Rep] - Amine_Mejrhirrou - 24.02.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
^ (4 char)
i don't understand ...


Re: Need help for a CMD (adminlevel) [++Rep] - Max_Coldheart - 24.02.2012

pawn Код:
dini_IntSet(file, "AdminLevel", reason);



Re: Need help for a CMD (adminlevel) [++Rep] - Twisted_Insane - 24.02.2012

Use this one:

PHP код:
dini_IntSet(file"AdminLevel"reason); 
You're saving an adminlevel, which is an integer!


Re: Need help for a CMD (adminlevel) [++Rep] - Shadow_ - 24.02.2012

Here, next time actually learn how stuff works before attempting it. you need to learn about strings, format, sscanf and dini. so head to the tutorial section << dont take it offensively.

pawn Код:
CMD:adminlevel(playerid, params[])
{
    if(PlayerMuted[playerid] == 1) return SendClientMessage(playerid, -1, "[SERVER PROTECTION] You are muted!");
    if(GetAdminLevel(playerid) >= 5 || IsPlayerAdmin(playerid))
    {
        new level, giveplayerid, sendername[MAX_PLAYER_NAME], str[128], pName[MAX_PLAYER_NAME], file[128];
        if(sscanf(params, "ui", giveplayerid, level)) SendClientMessage(playerid, -1, "USAGE: \"/adminlevel <playerid> <1 - 5>");
        else
        {
            if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, -1, "Player is not online.");
            GetPlayerName(giveplayerid, pName, sizeof(pName));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(file, sizeof(file), USER_FILE, pName);
            dini_IntSet(file, "AdminLevel", level);
            format(str, sizeof(str), "You have set the admin level of %s to %d", pName, level);
            SendClientMessage(playerid, -1, str);
            format(str, sizeof(str), "You have been ranked up/down ( admin team ) to level %d. use /ahelp", level);
            SendClientMessage(playerid, -1, str);
        }
    }
    else
    {
        SendClientMessage(playerid, -1, "You do not have access to this command.");
    }
    return 1;
}
++ rep.


Re: Need help for a CMD (adminlevel) [++Rep] - Twisted_Insane - 24.02.2012

Hell, why are you begging for reputation? That's pity, reputation gotta be earned and deserved...Real scripters do what they have to and wait, that's why they get more reputation than people which beg for it!

By the way, you wasn't the only one helping!


Re: Need help for a CMD (adminlevel) [++Rep] - Shadow_ - 24.02.2012

1. I never said i was the only one helping so why point out something so blaintently obvious?
2. I wasn't begging for reputation, if you think thats begging then you could do with heading into your city and look at some tramps sat in door-ways with a little tin shaking it. I simply said ++ rep. which he should do if what i posted helped him. just like he should do it to you if you helped him. So get off your high horse and stop moaning because you just told him to use a different function insted of actually reading his code and realising it wouldn't work anyway.