SA-MP Forums Archive
Stock problem, or maybe arguments problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Stock problem, or maybe arguments problem (/showthread.php?tid=431929)



Stock problem, or maybe arguments problem - LeeXian99 - 20.04.2013

Hello guys, I'm using Y_INI login/register system and decided to make /stats from it, so here's my script.

pawn Код:
CMD:stats(playerid,params[])
{
    new string[256], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    new score = GetPlayerScore(playerid);
    new cash = GetPlayerMoney(playerid);
    new kills = GetPlayerKills(playerid, name, Kills); //This line
    new deaths = GetPlayerDeaths(playerid, name, Deaths); //This line
    format(string,sizeof(string), "Name: %s\nCurrent ID: %d\nScore: %i\nCash: $%d\nKills: %i\nDeaths: %i", name, playerid, score, cash, kills, deaths);
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Your stats", string, "OK", "");
    return 1;
}

stock GetPlayerKills(playerid, name[], value[])
{
    INI_Int("Kills", pInfo[playerid][Kills]);
    return 1;
}

stock GetPlayerDeaths(playerid, name[], value[])
{
    INI_Int("Deaths", pInfo[playerid][Deaths]);
    return 1;
}
Код:
C:\Documents and Settings\User\Desktop\SAMP 0.3X Scripting\gamemodes\stuntproject.pwn(520) : error 035: argument type mismatch (argument 3)
C:\Documents and Settings\User\Desktop\SAMP 0.3X Scripting\gamemodes\stuntproject.pwn(521) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
How to fix it?


Re: Stock problem, or maybe arguments problem - HurtLocker - 20.04.2013

Why to create stocks for such short codes?
pawn Код:
CMD:stats(playerid,params[])
{
    new string[256], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    new score = GetPlayerScore(playerid);
    new cash = GetPlayerMoney(playerid);
    new kills = INI_Int("Kills", pInfo[playerid][Kills]);
    new deaths = INI_Int("Deaths", pInfo[playerid][Deaths]);
    format(string,sizeof(string), "Name: %s\nCurrent ID: %d\nScore: %i\nCash: $%d\nKills: %i\nDeaths: %i", name, playerid, score, cash, kills, deaths);
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Your stats", string, "OK", "");
    return 1;
}



Re: Stock problem, or maybe arguments problem - LeeXian99 - 20.04.2013

Errors:
Код:
C:\Documents and Settings\User\Desktop\SAMP 0.3X Scripting\gamemodes\stuntproject.pwn(537) : error 029: invalid expression, assumed zero
C:\Documents and Settings\User\Desktop\SAMP 0.3X Scripting\gamemodes\stuntproject.pwn(537) : error 001: expected token: ";", but found "return"
C:\Documents and Settings\User\Desktop\SAMP 0.3X Scripting\gamemodes\stuntproject.pwn(537) : error 017: undefined symbol "value"
C:\Documents and Settings\User\Desktop\SAMP 0.3X Scripting\gamemodes\stuntproject.pwn(537) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



AW: Stock problem, or maybe arguments problem - HurtLocker - 20.04.2013

Those errors have nothing to do with the stats command I gave you. Look at the errors, what does "value" have to do with what I gave you?


Re: Stock problem, or maybe arguments problem - iAidan - 20.04.2013

Put
pawn Код:
new value[128];
on the line with that error or above it. (Guessing it's on your stock)


Re: Stock problem, or maybe arguments problem - LeeXian99 - 20.04.2013

I think the value works with [Kills] and [Deaths]... I'm too new in Y_INI. :/


AW: Stock problem, or maybe arguments problem - HurtLocker - 20.04.2013

Dude, remove all unnecessary codes. If you have doubts about which to remove, post code here.


Re: Stock problem, or maybe arguments problem - LeeXian99 - 20.04.2013

Why do I need to remove it? if I remove it, it only shows Name, Score and Cash.. I want Kills and Deaths in it. :/

I will give out +rep to who has helped me out!


Re: Stock problem, or maybe arguments problem - DaRk_RaiN - 20.04.2013

Ignore the stocks
pawn Код:
CMD:stats(playerid,params[])
{
    new string[256], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    new score = GetPlayerScore(playerid);
    new cash = GetPlayerMoney(playerid);
    new kills = pInfo[playerid][Kills]; //This line
    new deaths = pInfo[playerid][Deaths]; //This line
    format(string,sizeof(string), "Name: %s\nCurrent ID: %d\nScore: %i\nCash: $%d\nKills: %i\nDeaths: %i", name, playerid, score, cash, kills, deaths);
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Your stats", string, "OK", "");
    return 1;
}



AW: Stock problem, or maybe arguments problem - HurtLocker - 20.04.2013

What's your current problem man? Where and why you use the variable "value"?