updating databases?
#1

hey guys..i've encountered something that's bugging me and i don't really know how to fix..
I am using YINI register system, and I've all my stats saving fine etc..
but once i started making an admin system, i noticed that the info as shown in /stats will only take place after a player relogged. but he still can use every command i coded for them..how can i make /stats being updated to show the exact values? thanks in advance!
Reply
#2

You're either checking the file stats via /stats, or your commands aren't checking/setting variables correctly if the commands still work and the /stats say it shouldn't.

I'd check your variables/enums/if statements e.t.c.
Reply
#3

Код:
CMD:stats(playerid, params[])
{
    new string[1000], title[128], playerName[MAX_PLAYER_NAME];

    GetPlayerName(playerid, playerName, sizeof(playerName));
    format(title, sizeof(title), ""COLOR_YELLOW"Displaying information about player - ["COLOR_SYSTEM"%s"COLOR_YELLOW"]", playerName);
    format(string,sizeof(string),""COLOR_SYSTEM"* New Zone Gaming Team Deathmatch - General Statistics *\n \n"COLOR_ORANGE"[General] - [Money: %d] | [Deaths: %d] | [Kills: %d] | [Score: %d]\n"COLOR_SYSTEM"[Administrative] - [Admin Level: %d]",PlayerInfo[playerid][pCash],PlayerInfo[playerid][pDeaths],PlayerInfo[playerid][pKills],PlayerInfo[playerid][pScore],PlayerInfo[playerid][pAdmin]);
    ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, title, string, "Close", "");

    return true;
}
here is my stats cmd..it does show k/d properly doesnt show score money admin lvl tho..


edit here are makeadmin and setscore cmds maybe something is wrong with them?

Код:
CMD:makeadmin(playerid, params[])
{
	if(IsPlayerAdmin(playerid))
	{
	    new id, level, string[126];
		if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, COL_SYSTEM, "* Syntax: /makeadmin "COLOR_ORANGE"[TargetID] [Level 1-1336]"COLOR_SYSTEM" *");
		PlayerInfo[id][pAdmin] = level;
		format (string, sizeof(string), "* System: "COLOR_ORANGE"[Administrator] - %s"COLOR_SYSTEM" has set your admin level to "COLOR_ORANGE"%d"COLOR_SYSTEM". *", GetNameEx(playerid), level);
	    SendClientMessage(id, COL_SYSTEM, string);
	    format (string, sizeof(string), "* System: You have set "COLOR_ORANGE"%s's"COLOR_SYSTEM" admin level to "COLOR_ORANGE"%d"COLOR_SYSTEM". *", GetNameEx(id), level);
	    SendClientMessage(playerid, COL_SYSTEM, string);
	}
	else
	{
	    SendClientMessage(playerid, COL_SYSTEM, "* System: You are "COLOR_LIGHTRED"not allowed"COLOR_SYSTEM" to use this command! *");
	}
	return 1;
}
//-----------------------------------------------------------------------------------------------------//
CMD:setscore(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3)
	{
		new string[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], pID, score;
		if(sscanf(params, "ud", pID, score)) return SendClientMessage(playerid, COL_SYSTEM, "* Syntax: /setscore "COLOR_ORANGE"[TargetID] [Score]"COLOR_SYSTEM" *");
		if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COL_SYSTEM, "* System: The targeted ID "COLOR_RED"isn't connected or didn't spawn"COLOR_SYSTEM" yet. *");
		GetPlayerName(playerid, name, sizeof(name));
	 	GetPlayerName(pID, pName, sizeof(pName));
		format(string, sizeof(string), "* System: "COLOR_ORANGE"[Administrator] - %s"COLOR_SYSTEM" has set your score to "COLOR_ORANGE"%d"COLOR_SYSTEM". *", name, score);
		SendClientMessage(pID, COL_SYSTEM, string);
		format(string, sizeof(string), "* System: You have set "COLOR_ORANGE"%s's"COLOR_SYSTEM" score to "COLOR_ORANGE"%d"COLOR_SYSTEM". *", pName, score);
		SendClientMessage(playerid, COL_SYSTEM, string);
		SetPlayerScore(pID, score);
	}
	else
	{
	    SendClientMessage(playerid, COL_SYSTEM, "* System: You are "COLOR_LIGHTRED"not allowed"COLOR_SYSTEM" to use this command! *");
 	}
	return 1;
}
thanks in advance!
Reply
#4

That looks like it should work fine. It appears to reference the right things in the right places.
Reply
#5

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
That looks like it should work fine. It appears to reference the right things in the right places.
but it doesnt
Reply
#6

Has it ever worked?

Is there anything else that is bugging out?

What were you adding when it started bugging out?
Reply
#7

There are two different variables, the one of your database and the ones of your script, update them both EVERYTIME changes are made, everywhere and you will see it will fix problems like these.
Reply
#8

now it seems only the score tab won't show and everything else is fine..

edit: i didn't edit any code..just gmxed
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)