Update player statistics with database stats
#1

Hello all, I'm trying to make a function to update player statistics in-game by getting statistics from a mysql database. The problem is that if the player's in-game admin level is 0, then it will go through the if statement. If it is any number other than 0, then it won't go through the if statement.

The code below supposed to check if the player's admin level is the same as the one inside the database, if it isn't then it would correct the player's admin level in-game to match the database's admin level.

Here's my code.
pawn Код:
// Code removed.
I would appreciate all the help I can get.

Thanks.
-DBan
Reply
#2

What exactly are you trying to accomplish? Are you just trying to load the data into the player's variable, or are you trying to do something else?
Reply
#3

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
What exactly are you trying to accomplish? Are you just trying to load the data into the player's variable, or are you trying to do something else?
Getting data from the MySQL database, and then load it into the player's variables.

However, I am trying to make it so that it will not do it unless the player's variables do not match the field inside the database.
Reply
#4

pawn Код:
if(!strcmp(save, PlayerInfo[playerid][adminlevel]))
should be

pawn Код:
if(strval(save) != PlayerInfo[playerid][adminlevel])
assuming that PlayerInfo[playerid][adminlevel] is an integer.
Reply
#5

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
pawn Код:
if(!strcmp(save, PlayerInfo[playerid][adminlevel]))
should be

pawn Код:
if(strval(save) != PlayerInfo[playerid][adminlevel])
assuming that PlayerInfo[playerid][adminlevel] is an integer.
Meh, i've tried that but accidentally left it as this:
pawn Код:
if(strval(save) != PlayerInfo[playerid][adminlevel]))
So, I just assumed it didn't work.

Anyways, now it works. Tyvm.
Reply
#6

Brother I DOnt Know how i chagne please reply
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)