SA-MP Forums Archive
Errors..... - 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: Errors..... (/showthread.php?tid=515576)



Errors..... - Johnson_Brooks - 26.05.2014

Code:
pawn Код:
mysql_format(dbHandle,Query, sizeof(Query), "SELECT * FROM `PlayerData` WHERE `Username` = '%e'",Name(playerid));
Errors:
Код:
C:\Users\\Desktop\GTA SA-MP Server\filterscripts\Test.pwn(922) : error 012: invalid function call, not a valid address
C:\Users\\Desktop\GTA SA-MP Server\filterscripts\Test.pwn(922) : warning 215: expression has no effect
C:\Users\\Desktop\GTA SA-MP Server\filterscripts\Test.pwn(922) : error 001: expected token: ";", but found ")"
C:\Users\\Desktop\GTA SA-MP Server\filterscripts\Test.pwn(922) : error 029: invalid expression, assumed zero
C:\Users\\Desktop\GTA SA-MP Server\filterscripts\Test.pwn(922) : fatal error 107: too many error messages on one line
Its under OnPlayerConnect incase you're wondering


Re: Errors..... - WardenCS - 26.05.2014

bcx c


Re: Errors..... - Ghazal - 26.05.2014

Show us all the "OnPlayerConnect"


Re: Errors..... - Konstantinos - 26.05.2014

I don't think "Name" is a function so using it as "Name(playerid)" makes it invalid.


Re: Errors..... - Johnson_Brooks - 26.05.2014

pawn Код:
public OnPlayerConnect(playerid)
{
    SetPlayerMapIcon( playerid, 12, -2462.4688,132.2999,35.1719, 52, 0, MAPICON_LOCAL );
    IsAfk[playerid] = 0; // When the player joins, he is not afk , OF COURSE!
    new string[64];
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,Name,MAX_PLAYER_NAME);
    format(string,sizeof string,"[{00FF00}JOIN{EEEEEE}]%s has joined the server.",Name);
    SendClientMessageToAll(COLOR_WHITE,string);
    SendDeathMessage(-1, playerid, 200);
    ResetVars(playerid);
    new Query[300], rows, fields, string1[128];
    mysql_format(dbHandle,Query, sizeof(Query), "SELECT * FROM `PlayerData` WHERE `Username` = '%e'",Name(playerid));
    mysql_query(dbHandle,Query);
    cache_get_data(rows, fields);
    if(rows)
    {
        format(string1,sizeof(string1),"{EEEEEE}Welcome back %s\n{EEEEEE}Please login to continue playing",Name(playerid));
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login",string1,"Login","Quit");
    }
    else if(!rows)
    {
        format(string1,sizeof(string1),"{EEEEEE}Welcome %s\n{EEEEEE}Please enter a password to register your account",Name(playerid));
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Register",string1,"Register","Quit");
    }
    return 1;
}
Here's the full onplayerconnect


Re: Errors..... - Konstantinos - 26.05.2014

Yes, it's not. Change "Name(playerid)" to "Name".


Re: Errors..... - Johnson_Brooks - 26.05.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Yes, it's not. Change "Name(playerid)" to "Name".
Now i get 11 warnings :
Код:
C:\Users\\Desktop\GTA SA-MP Server\filterscripts\test.pwn(980) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\\Desktop\GTA SA-MP Server\filterscripts\test.pwn(1138) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Desktop\GTA SA-MP Server\filterscripts\test.pwn(1165) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\\Desktop\GTA SA-MP Server\filterscripts\test.pwn(1303) : warning 217: loose indentation
C:\Users\\Desktop\GTA SA-MP Server\filterscripts\test.pwn(1551) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\\Desktop\GTA SA-MP Server\filterscripts\test.pwn(1568) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\\Desktop\GTA SA-MP Server\filterscripts\test.pwn(1704) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\\Desktop\GTA SA-MP Server\filterscripts\test/pwn(1765) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\\Desktop\GTA SA-MP Server\filterscripts\test/.pwn(1817) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\\Desktop\GTA SA-MP Server\filterscripts\test..pwn(1842) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\\Desktop\GTA SA-MP Server\filterscripts\test..pwn(1900) : warning 219: local variable "pName" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


11 Warnings.



Re: Errors..... - Konstantinos - 26.05.2014

"pName" is declared as global and you declare it as local too, that's why it gives you the warning. Use pName directly without declaring it or declare a variable with other name.


Re: Errors..... - Johnson_Brooks - 26.05.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
"pName" is declared as global and you declare it as local too, that's why it gives you the warning. Use pName directly without declaring it or declare a variable with other name.
Ill try it .


Re: Errors..... - Johnson_Brooks - 26.05.2014

EDIT: Im getting alot of errors . Looks like i wont update to MySQL anytime soon .
I'll keep trying . Does it matter if i use my saving system as a filterscript ? Or how can i include my saving syste in my gamemode ? Like
pawn Код:
#include <myAdmin>