INI Bug
#1

http://i50.tinypic.com/214a0k5.png

i have been coded something (click player) and it shows me wrong stats of that player look this picture it shows 11kils and 9deaths and level 10 even that player has 0 in all of them here's the picture and the code P.S: there is no error's/warning on the script

http://i50.tinypic.com/214a0k5.png

Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{

   PlayerInfo[playerid][pLevel] = INI_ReadInt("level");
   PlayerInfo[playerid][pKills] = INI_ReadInt("kills");
   PlayerInfo[playerid][pDeaths] = INI_ReadInt("Deaths");

    INI_Close();

  new PName[MAX_PLAYER_NAME],strg [190];
 GetPlayerName(clickedplayerid, PName, sizeof (PName));
  format(strg,sizeof(strg),"{F81414} you are viewing {FFFFFF} %s stats \n {00CED1} Kills : {FFFFFF} %d \n {00CED1} Deaths : {FFFFFF} %d \n {00CED1} Level : {FFFFFF} %d  ",PName,pKills,pDeaths,pLevel);
  ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "{00FF04}Player Stats",strg,"Close","Done");
  

	return 1;
}
here's player file in scriptfiles

Kills=0
Deaths=0
Level=0
Reply
#2

Shouldn't playerid be clickedplayerid?

Also, you need a file to read from and close.
Reply
#3

i have a file already ofc
Reply
#4

Try this

pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    PlayerInfo[clickedplayerid][pLevel] = INI_ReadInt("level");
    PlayerInfo[clickedplayerid][pKills] = INI_ReadInt("kills");
    PlayerInfo[clickedplayerid][pDeaths] = INI_ReadInt("Deaths");

    INI_Close();

    new PName[MAX_PLAYER_NAME],strg [190];
    GetPlayerName(clickedplayerid, PName, sizeof (PName));
    format(strg,sizeof(strg),"{F81414} you are viewing {FFFFFF} %s stats \n {00CED1} Kills : {FFFFFF} %d \n {00CED1} Deaths : {FFFFFF} %d \n {00CED1} Level : {FFFFFF} %d  ",PName,pKills,pDeaths,pLevel);
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "{00FF04}Player Stats",strg,"Close","Done");
    return 1;
}
Reply
#5

still the same bug.
Reply
#6

You need to open a file...

new INI:File = INI_Open("SomeFile.ini");
Reply
#7

Try this
PHP код:
public OnPlayerClickPlayer(playeridclickedplayeridsource)
{
   new 
INI:File INI_Open(YOUR INI PATH(playerid));
   
PlayerInfo[playerid][pLevel] = INI_ReadInt("level");
   
PlayerInfo[playerid][pKills] = INI_ReadInt("kills");
   
PlayerInfo[playerid][pDeaths] = INI_ReadInt("Deaths");

    
INI_Close();

  new 
PName[MAX_PLAYER_NAME],strg [190];
 
GetPlayerName(clickedplayeridPNamesizeof (PName));
  
format(strg,sizeof(strg),"{F81414} you are viewing {FFFFFF} %s stats \n {00CED1} Kills : {FFFFFF} %d \n {00CED1} Deaths : {FFFFFF} %d \n {00CED1} Level : {FFFFFF} %d  ",PName,pKills,pDeaths,pLevel);
  
ShowPlayerDialog(playerid1DIALOG_STYLE_MSGBOX"{00FF04}Player Stats",strg,"Close","Done");
  

    return 
1;

Reply
#8

Quote:
Originally Posted by tyler12
Посмотреть сообщение
You need to open a file...

new INI:File = INI_Open("SomeFile.ini");
How do you know he is using y_ini? He could be as well using fIini (or bIni).

Instead of accessing an enum index and setting the playerid variables, you should create variables to use as reference.
pawn Код:
new level, kills, deaths;


level = INI_ReadInt("level");
kills = INI_ReadInt("kills");
deaths = INI_ReadInt("Deaths");

INI_Close();

new PName[MAX_PLAYER_NAME],strg [190];
GetPlayerName(clickedplayerid, PName, sizeof (PName));
format(strg,sizeof(strg),"{F81414} you are viewing {FFFFFF} %s stats \n {00CED1} Kills : {FFFFFF} %d \n {00CED1} Deaths : {FFFFFF} %d \n {00CED1} Level : {FFFFFF} %d  ",PName,kills,deaths,level);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "{00FF04}Player Stats",strg,"Close","Done");
Reply
#9

Quote:
Originally Posted by tyler12
Посмотреть сообщение
You need to open a file...

new INI:File = INI_Open("SomeFile.ini");

Код:
D:\script\gamemodes\DeathMatchADD.pwn(454) : warning 204: symbol is assigned a value that is never used: "File"
D:\script\gamemodes\DeathMatchADD.pwn(454) : warning 213: tag mismatch
Reply
#10

here's the full code P.S: i'm using Y_INI

Код:
stock getINI(playerid)
{
  new account[64];
  format(account,30,"Users/%s.ini",gPlayerName[playerid]);
  return account;
}
Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
   PlayerInfo[playerid][pLevel] = INI_ReadInt("level");
   PlayerInfo[playerid][pKills] = INI_ReadInt("kills");
   PlayerInfo[playerid][pDeaths] = INI_ReadInt("Deaths");

    INI_Close();

  new PName[MAX_PLAYER_NAME],strg [190];
 GetPlayerName(clickedplayerid, PName, sizeof (PName));
  format(strg,sizeof(strg),"{F81414} you are viewing {FFFFFF} %s stats \n {00CED1} Kills : {FFFFFF} %d \n {00CED1} Deaths : {FFFFFF} %d \n {00CED1} Level : {FFFFFF} %d  ",PName,pKills,pDeaths,pLevel);
  ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "{00FF04}Player Stats",strg,"Close","Done");


    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)