SA-MP Forums Archive
setlevel command help please - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: setlevel command help please (/showthread.php?tid=212623)



setlevel command help please - [MKD]Max - 17.01.2011

hello guys please help me im realy need help so i make some admin command and here is one



Код:
dcmd_mmode(playerid, params[])
{
    new givePlayer, str[128], PlayerFile[100], pName[24];
    if(Player[playerid][admin] < 2){
	return SendClientMessage(playerid, COLOR_RED, "You Dont Have Right To Use This Command");
	}
    new id;
    if(sscanf(params, "u", id))
	{
	    SendClientMessage(playerid, COLOR_RED, "USAGE: /mmode [playerid]");
	    return 1;
	}
    else if (id == INVALID_PLAYER_ID)
	{
	    SendClientMessage(playerid, COLOR_RED, "Player not found");
	    return 1;
	}
    else
    {
    	Player[playerid][admin] = 1;
       	SendClientMessage(givePlayer, COLOR_GREEN, "An administrator has given you mode rights.");
		format(str, sizeof(str), "You have give %s(%d) mode rights.", pName, playerid);
		SendClientMessage(playerid, COLOR_GREEN, str);
  		format(PlayerFile, sizeof(PlayerFile), "maxadmin/users/%s.ini", pName);
		dini_IntSet(PlayerFile, "Level", 1);
    }
    return 1;
}
now when i do this command on my self its all work but when i got checkout file scriptfile/maxadmin/users/Max.inc i see no change


Re: setlevel command help please - [MKD]Max - 17.01.2011

bumpp.


Re: setlevel command help please - Ihsan-Cingisiz - 17.01.2011

Quote:
Originally Posted by [MKD]Max
Посмотреть сообщение
hello guys please help me im realy need help so i make some admin command and here is one



Код:
dcmd_mmode(playerid, params[])
{
    new givePlayer, str[128], PlayerFile[100], pName[24];
    if(Player[playerid][admin] < 2){
	return SendClientMessage(playerid, COLOR_RED, "You Dont Have Right To Use This Command");
	}
    new id;
    if(sscanf(params, "u", id))
	{
	    SendClientMessage(playerid, COLOR_RED, "USAGE: /mmode [playerid]");
	    return 1;
	}
    else if (id == INVALID_PLAYER_ID)
	{
	    SendClientMessage(playerid, COLOR_RED, "Player not found");
	    return 1;
	}
    else
    {
    	Player[playerid][admin] = 1;
       	SendClientMessage(givePlayer, COLOR_GREEN, "An administrator has given you mode rights.");
		format(str, sizeof(str), "You have give %s(%d) mode rights.", pName, playerid);
		SendClientMessage(playerid, COLOR_GREEN, str);
  		format(PlayerFile, sizeof(PlayerFile), "maxadmin/users/%s.ini", pName);
		dini_IntSet(PlayerFile, "Level", 1);
    }
    return 1;
}
now when i do this command on my self its all work but when i got checkout file scriptfile/maxadmin/users/Max.inc i see no change
Change this:
Код:
Player[playerid][admin] = 1;
Into this:
Код:
Player[giveplayer][admin] = 1;



Re: setlevel command help please - Ihsan-Cingisiz - 17.01.2011

Quote:
Originally Posted by Ihsan-Cingisiz
Посмотреть сообщение
Change this:
Код:
Player[playerid][admin] = 1;
Into this:
Код:
Player[givePlayer][admin] = 1;
Because otherwise it will set your own Alevel.

(I'm not a real sscanf user but i know this is the problem, because of the Dini :P)


Re: setlevel command help please - blackwave - 17.01.2011

Duh, haven't you forgotten the level parament? Obviously you see no changes, since it's 1, and will be set for 1. And 1 == 1.