SA-MP Forums Archive
Problem with my script. - 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: Problem with my script. (/showthread.php?tid=602363)



[RESOLVED] - TheBoZ - 06.03.2016

Somehow i'm getting these errors in my script:
EDIT] Now i have another problem.
Код:
C:\Users\Nelson.Paulo2301-PC\Desktop\Database.pwn(141) : error 017: undefined symbol "pScore"
C:\Users\Nelson.Paulo2301-PC\Desktop\Database.pwn(142) : error 035: argument type mismatch (argument 2)
Coded script:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/stats", true))
{
new string[500];
format(string,sizeof(string),"Password: %s | Money: %d | Deaths: %d | Kills: %d | Score: %d | Admin: %d ",PlayerInfo[playerid][pPass],PlayerInfo[playerid][pCash],PlayerInfo[playerid][pDeaths],PlayerInfo[playerid][pKills],PlayerInfo[playerid][pScore],PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid,COL_GREEN,string);
        return 1;
}
    return 0;

}



Re: Problem with my script. - TheBoZ - 06.03.2016

Bump, really need this resolved as fast as possible.


Re: Problem with my script. - TheBoZ - 06.03.2016

[EDIT] Now i have another problem.
Код:
C:\Users\Nelson.Paulo2301-PC\Desktop\Database.pwn(141) : error 017: undefined symbol "pScore"
C:\Users\Nelson.Paulo2301-PC\Desktop\Database.pwn(142) : error 035: argument type mismatch (argument 2)
Coded script:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/stats", true))
{
new string[500];
format(string,sizeof(string),"Password: %s | Money: %d | Deaths: %d | Kills: %d | Score: %d | Admin: %d ",PlayerInfo[playerid][pPass],PlayerInfo[playerid][pCash],PlayerInfo[playerid][pDeaths],PlayerInfo[playerid][pKills],PlayerInfo[playerid][pScore],PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid,COL_GREEN,string);
        return 1;
}
    return 0;

}



Re: Problem with my script. - nerovani - 06.03.2016

Can you show us the "enum" of PlayerInfo? You probably forgot to add "pScore" in the enum.


Re: Problem with my script. - TheBoZ - 06.03.2016

Yes, i can.

Код:
enum pInfo
{
    pPass,
    pCash,
	pScore,
    pAdmin,
    pKills,
    pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
	INI_Int("Score",PlayerInfo[playerid][pScore]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    return 1;
}
Everything is here, any other suggestion?


Re: Problem with my script. - itsCody - 06.03.2016

PHP код:
INI_Int("Password",PlayerInfo[playerid][pPass]); 
Why is the password an INT?
Also, why aren't you hashing their passwords..?


Re: Problem with my script. - TheBoZ - 06.03.2016

I'm really new to scripting, just started some days ago, i'm downloading whirlpool to hash the password, in the mean while, how do i fix this?


Re: Problem with my script. - TheHonnor - 06.03.2016

You must change from ` PlayerInfo[playerid][pScore] ` to ` GetPlayerScore(playerid) ` !

When the player connects , you will put in OnPlayerConnect:

SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);

Hope it helps!


Re: Problem with my script. - TheBoZ - 06.03.2016

I'm having the same error.
Anyways, the line that is indicating the problem is
Код:
SendClientMessage(playerid,COL_GREEN,string);
But if i remove SendCLientMessage it works, but as everyone knows when you perform the command in-game it doesnt appear any kind of text, anyways:

Line: SendClientMessage(playerid,COL_GREEN,string);

Error: C:\Users\Nelson.Paulo2301-PC\Desktop\Database.pwn(145) : error 035: argument type mismatch (argument 2)

Full code:
http://pastebin.com/rxAZhvtr

Full command:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/stats", true))
{
new string[500];
format(string,sizeof(string),"Password: %s | Money: %d | Deaths: %d | Kills: %d | Score: %d | Admin: %d ",PlayerInfo[playerid][pPass],PlayerInfo[playerid][pCash],PlayerInfo[playerid][pDeaths],PlayerInfo[playerid][pKills],PlayerInfo[playerid][pScore],PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid,COL_GREEN,string);
        return 1;
}
    return 0;
 
}



Re: Problem with my script. - TheHonnor - 06.03.2016

Quote:
Originally Posted by TheBoZ
Посмотреть сообщение
Like this?
Yeah, this should work.

EDIT: You forgot a parenthesis.