My server is automatic gives levels ! Solve Pls
#1

Hello, i have created a server Deathmatch and after i finished that someone joined the server then i typed /admins i found his level 20 and my level is 510 how is that? anyone joining the server take a level
Reply
#2

Well, do we have to guess your code?
Reply
#3

Show the code levels and admins.
Reply
#4

i have this
Код:
CMD:giveladmin(playerid,params[]) {
	new string[128],playername[MAX_PLAYER_NAME];
	if(IsPlayerAdmin(playerid)) {
		if(PlayerInfo[playerid][LoggedIn] == 0) return SendClientMessage(playerid,COLOR_RED,"ERROR: Player must be registered to be an admin");
		CMDMessageToAdmins(playerid,"GIVELADMIN");
		GetPlayerName(playerid, playername, sizeof(playername));
		new year,month,day;
		getdate(year, month, day);
		format(string,128,"You have made yourself [Level 13] on %d/%d/%d", day, month, year);
		SendClientMessage(playerid,blue,string);
		format(string,128,"%s has made him/herself [Level 13] on %d/%d/%d", playername, day, month, year);
		SaveToFile("AdminLog",string);
		dUserSetINT(PlayerName2(playerid)).("level",(13));
		PlayerInfo[playerid][Level] = 13;
	} else	{
		SendClientMessage(playerid,COLOR_RED,"ERROR: You must be logged into rcon to use this command");
	}
	return 1;
}
and this
Код:
CMD:setlevel(playerid,params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
		if(PlayerInfo[playerid][Level] >= 13 || IsPlayerAdmin(playerid)) {
		    new tmp[128], tmp2[128], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		    if(isnull(params)) return SendClientMessage(playerid, red, "{00FF40}Usage: /setlevel {FF00D9}[PlayerID][Level][0-13]");
	    	new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);
			if(isnull(tmp2)) return SendClientMessage(playerid, red, "{00FF40}USAGE: /setlevel [playerid] [level]");
			level = strval(tmp2);

			if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
				if(PlayerInfo[player1][LoggedIn] == 1) {
					if(level > ServerInfo[MaxAdminLevel] ) return SendClientMessage(playerid,red,"ERROR: Incorrect Level");
					if(level == PlayerInfo[player1][Level]) return SendClientMessage(playerid,red,"ERROR: Player is already this level");
	       			CMDMessageToAdmins(playerid,"SETLEVEL");
					GetPlayerName(player1, playername, sizeof(playername));	GetPlayerName(playerid, adminname, sizeof(adminname));
			       	new year,month,day;   getdate(year, month, day); new hour,minute,second; gettime(hour,minute,second);

					if(level > 0) format(string,sizeof(string),"{4EEE94}Administrator %s has set you to Administrator Status {0011FF}[level %d] -|",adminname, level);
					else format(string,sizeof(string),"{4EEE94}Administrator %s has set you to Player Status {49F505}[level %d]",adminname, level);
					SendClientMessage(player1,blue,string);

					if(level > PlayerInfo[player1][Level]) GameTextForPlayer(player1,"~y~Promoted", 5000, 5);
					else GameTextForPlayer(player1,"~r~DEMOTED", 5000, 5);

					format(string,sizeof(string),"{4EEE94}You have made %s Level %d on {66CDAA}%d/%d/%d at %d:%d:%d", playername, level, day, month, year, hour, minute, second); SendClientMessage(playerid,blue,string);
					format(string,sizeof(string),"{4EEE94}Administrator %s has made %s Level %d on {0011FF}%d/%d/%d at %d:%d:%d",adminname, playername, level, day, month, year, hour, minute, second);
					SaveToFile("AdminLog",string);
					dUserSetINT(PlayerName2(player1)).("level",(level));
					PlayerInfo[player1][Level] = level;
					return PlayerPlaySound(player1,1057,0.0,0.0,0.0);
				} else return SendClientMessage(playerid,red,"ERROR: Player must be registered and logged in to be admin");
			} else return SendClientMessage(playerid, red, "{00FF40}ERROR: {03F2FF}Player is not connected");
		} else return SendClientMessage(playerid,red,"ERROR: {FF00D9}You are not a high enough {FFFFFF}level {00FF40}to use this command");
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
and offline set level
Код:
CMD:osetlevel(playerid, params[]) {
            if(IsPlayerAdmin(playerid)) {
	        new string[128], tmp[128], tmp2[128], Index; tmp = strtok(params, Index), tmp2 = strtok(params, Index);
	        if(isnull(tmp) || isnull(tmp2)) return SendClientMessage(playerid, red, "USAGE: /osetlevel [playername] [level]");
	    	new level = strval(tmp2);
	    	if(!udb_Exists(PlayerName2(playerid))) {
		    new file[256];
			format(file, sizeof(file), "/ladmin/users/%s.ini", udb_encode(pName(playerid)));
			dUserSetINT(PlayerName2(playerid)).("level",(level));  //dUserSetINT(PlayerName2(player1)).("level",(level));   dUserSetINT(PlayerName2(playerid)), "Level", level);
			PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
    	    format(string, sizeof(string), "[INFO]: You have successfully set \"%s's\" level to %d", tmp, level);
    	    CMDMessageToAdmins(playerid, "OSETLEVEL");
			return SendClientMessage(playerid, blue, string);
		    } else return SendClientMessage(playerid, red, "ERROR: This player doesnt have an account");
	        } else return SendClientMessage(playerid, red, "ERROR: You are not a high enough level to use this command");
}
Reply
#5

Happens with memory corruption, it sets random values to any variable. I had a similar problem.

You might have such a thing in your script:

PHP код:
new test[128];
format(test96"...", ...); 
(Thanks to Southclaw and Kar)
Reply
#6

what u did to fix that ?
iam not perfect in scripting
Reply
#7

Find it and fix it.
Reply
#8

what u saying ? so why i posted my problem here? hah
Reply
#9

At least I provided a solution for you. The problem might be somewhere in your gamemode. We are not here to search for the bug and fix it. Anyways, If the problem is in the script you provided, I am not going to look through it.
Reply
#10

The first way might be what @AjaxM said, and the seconds one you're probably not resetting the variable of admin or whatever when they connect/disconnect.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)