Ostats
#1

So, iam trying to get the player stats from the data base

But not working fine gives me errors

PHP код:
IRCCMD:ostats(botidchannel[], user[], host[], params[])
{
    new 
account[24],Query[72];
    if(
sscanf(params"s[24]"account))
         return 
IRC_Say(groupIDchannel"7Usage: 1!ostats [Account]");
    if(
<= strlen(account) >= 24) return IRC_Say(groupIDchannel"7Error: 1Player name cannot exceed 24 characters!");
    
mysql_format(mysqlQuerysizeof(Query), "SELECT Hours,Minutes,SkinID,Admin,Tokens,RaceWon,Kills,Deaths,Score,Money,Rdate FROM `players` WHERE `Username` = '%e'"account);
    
mysql_query(mysqlQuery);
    if(
cache_num_rows() >= 1)
    {
            new 
score,string[143];
            
cache_get_value_name_int(0"SkinID"pData[account][Skin]);
            
cache_get_value_name_int(0"Admin"pData[account][Admin]); //we're getting a field 4 from row 0. And since it's an integer, we use cache_get_row_int
            
cache_get_value_name_int(0"Money"pData[account][Money]);//Above
            
cache_get_value_name_int(0,"Kills"pData[account][Kills]);
            
cache_get_value_name_int(0,"Tokens"pData[account][Tokens]);
            
cache_get_value_name_int(0"Deaths"pData[account][Deaths]);
            
cache_get_value_name_int(0"Hours"pData[account][pHours]);
            
cache_get_value_name_int(0"Minutes"pData[account][pMinutes]);
            
cache_get_value_name_int(0"RaceWon"pData[account][RaceWon]);
            
//cache_get_value_name_int(0, "Score", score);
            //SetPlayerScore(playerid, score);
    
}
    else 
IRC_Say(groupIDchannel"7Error: 1this name not exists on database");
    return 
1;

Errors

Код:
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12484) : error 033: array must be indexed (variable "account")
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12485) : error 033: array must be indexed (variable "account")
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12486) : error 033: array must be indexed (variable "account")
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12487) : error 033: array must be indexed (variable "account")
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12488) : error 033: array must be indexed (variable "account")
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12489) : error 033: array must be indexed (variable "account")
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12490) : error 033: array must be indexed (variable "account")
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12491) : error 033: array must be indexed (variable "account")
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12492) : error 033: array must be indexed (variable "account")
Reply
#2

your 'account' variable is indexed and so the usage will also be indexed e.g
Quote:

pData[account[]][Skin] //Note the brackets in account[]

Reply
#3

Quote:
Originally Posted by coool
Посмотреть сообщение
your 'account' variable is indexed and so the usage will also be indexed e.g
now giving this
Код:
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12484) : error 029: invalid expression, assumed zero
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12485) : error 029: invalid expression, assumed zero
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12486) : error 029: invalid expression, assumed zero
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12487) : error 029: invalid expression, assumed zero
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12488) : error 029: invalid expression, assumed zero
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12489) : error 029: invalid expression, assumed zero
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12490) : error 029: invalid expression, assumed zero
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12491) : error 029: invalid expression, assumed zero
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12492) : error 029: invalid expression, assumed zero
Reply
#4

Change "account" to "Account"
Reply
#5

Quote:
Originally Posted by aoky
Посмотреть сообщение
Change "account" to "Account"
Same
Reply
#6

Try this

PHP код:
pData[account[0]][Skin
Reply
#7

Quote:
Originally Posted by RxErT
Посмотреть сообщение
Try this

PHP код:
pData[account[0]][Skin
sameee
Reply
#8

You're using the variable 'account' which is string as integer for player id in your pData array.
Reply
#9

Quote:
Originally Posted by oMa37
Посмотреть сообщение
You're using the variable 'account' which is string as integer for player id in your pData array.
What do you mean by that? i should change account?
Reply
#10

What are you going to do after you load the player's stats? If you are going to show it in your IRC by a message, you should assign the values of the loaded data to new variables.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)