PDA

View Full Version : What's wrong with this?


Rudy_
19/06/2012, 11:48 AM
Hey guys, i'm getting some errors and Everything seems fine.
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""BLUE"Login",""BLUE"Enter your Password To Login.","Login","Cancle");
}
and the errors

C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(160) : error 029: invalid expression, assumed zero
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(160) : warning 215: expression has no effect
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(160) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(160) : warning 215: expression has no effect
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(160) : error 001: expected token: ";", but found "-string-"
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(160) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.

What can cause the problem?

BrandyPenguin
19/06/2012, 11:49 AM
Try:
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""#BLUE"Login",""#BLUE"Enter your Password To Login.","Login","Cancle");

Rudy_
19/06/2012, 11:50 AM
what's wrong with you?
Nope not working

BrandyPenguin
19/06/2012, 11:54 AM
Show how is defined your BLUE?

FUNExtreme
19/06/2012, 11:54 AM
Remove all the colour embedding parts and recompile. If the errors are gone then you know you did something wrong with the embedding. If they are not gone, then there is a different problem (which I can't seem to find).

Also, Are your colours defined like this {FFFFFF} for embedding?

Skaizo
19/06/2012, 11:59 AM
the color must be embedding
exemple:you are using Blue you must defined #define BLUE "{FFFFFF}"
FFFF its white change it to blue

Rudy_
19/06/2012, 12:00 PM
here's how i did it
#define BLUE 0x0000FFFF
#define GREEN 0x008000FF
#define PURPLE 0x800080AA
#define GREY 0x696969FF

MP2
19/06/2012, 12:04 PM
You need to define it as a string, with the curly brackets.

#define E_BLUE "{0000FF}"

Rudy_
19/06/2012, 12:05 PM
ok i changed them

#define PW_COLOR {FF0000}
#define PW_WHITE {FFFFFF}

code

public OnPlayerConnect(playerid)
{
GetPlayerName(playerid, gPlayerName[playerid], MAX_PLAYER_NAME);
if (fexist(getINI(playerid)))
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Enter your {FF0000}Password {FFFFFF}To Login", "Login", "Cancle");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Register", "Type your {FF0000}password{FFFFFF} below to register a new account", "Register","Cancle");
}
errors

C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(180) : warning 217: loose indentation
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(180) : error 029: invalid expression, assumed zero
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(180) : error 004: function "OnPlayerSpawn" is not implemented
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(197) : warning 225: unreachable code
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(197) : error 029: invalid expression, assumed zero
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(197) : error 004: function "OnPlayerDeath" is not implemented
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(199) : error 017: undefined symbol "killerid"
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(202) : error 017: undefined symbol "killerid"
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(206) : warning 225: unreachable code
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(206) : error 029: invalid expression, assumed zero
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(206) : error 004: function "OnVehicleSpawn" is not implemented
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(211) : warning 225: unreachable code
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(211) : error 029: invalid expression, assumed zero
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(211) : error 004: function "OnVehicleDeath" is not implemented
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(215) : warning 225: unreachable code
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(215) : error 029: invalid expression, assumed zero
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(215) : error 004: function "OnPlayerText" is not implemented
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(220) : warning 225: unreachable code
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(220) : error 029: invalid expression, assumed zero
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(220) : error 004: function "zcmd_OnPlayerCommandText" is not implemented
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(222) : error 017: undefined symbol "cmdtext"
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(230) : warning 225: unreachable code
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(230) : error 029: invalid expression, assumed zero
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(230) : error 004: function "OnPlayerEnterVehicle" is not implemented
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(235) : warning 225: unreachable code
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(235) : error 029: invalid expression, assumed zero
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(235) : error 004: function "OnPlayerExitVehicle" is not implemented
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(240) : warning 225: unreachable code
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(240) : error 029: invalid expression, assumed zero
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(240) : error 004: function "OnPlayerStateChange" is not implemented
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(245) : warning 225: unreachable code
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(245) : error 029: invalid expression, assumed zero
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(245) : error 004: function "OnPlayerEnterCheckpoint" is not implemented
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(250) : warning 225: unreachable code
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(250) : error 029: invalid expression, assumed zero
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(250) : error 004: function "OnPlayerLeaveCheckpoint" is not implemented
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(255) : warning 225: unreachable code
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(255) : error 029: invalid expression, assumed zero

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


26 Errors.

Rudy_
19/06/2012, 12:13 PM
Anyone i need to fix this Now :/

Skaizo
19/06/2012, 12:14 PM
you missing brackets
use this to find http://forum.sa-mp.com/showthread.php?t=322839&highlight=bracket
and

C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(199) : error 017: undefined symbol "killerid"
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripte r.pwn(202) : error 017: undefined symbol "killerid"

show script

Rudy_
19/06/2012, 12:18 PM
GivePlayerMoney(killerid,500);

Skaizo
19/06/2012, 12:22 PM
//At top of script
new killerid[MAX_PLAYERS];

Rudy_
19/06/2012, 12:31 PM
Nvm.. i fixed it

[MM]RoXoR[FS]
19/06/2012, 12:32 PM
#define PW_COLOR "{FF0000}"
#define PW_WHITE "{FFFFFF}"

Rudy_
19/06/2012, 01:02 PM
Guys i'm using SII and it won't save i registered once and relogg'd still ask's to register.
here's my code

GetPlayerName(playerid, gPlayerName[playerid], MAX_PLAYER_NAME);
if(fexist(getINI(playerid)))
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "{FF0000}""Login", "Enter your {FF0000}Password {FFFFFF}To Login", "Login", "Cancle");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", "{FFFFFF}Enter your {FF0000}Password {FFFFFF}To register new account", "Register", "Cancle");
}

Skaizo
19/06/2012, 01:07 PM
Guys i'm using SII and it won't save i registered once and relogg'd still ask's to register.
here's my code

GetPlayerName(playerid, gPlayerName[playerid], MAX_PLAYER_NAME);
if(fexist(getINI(playerid)))
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "{FF0000}""Login", "Enter your {FF0000}Password {FFFFFF}To Login", "Login", "Cancle");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", "{FFFFFF}Enter your {FF0000}Password {FFFFFF}To register new account", "Register", "Cancle");
}

add code from OnDialogResponse register and login

Rudy_
19/06/2012, 01:09 PM
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch (dialogid)
{
case DIALOG_REGISTER:
{
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", "{FF0000}You have entered wrong password\nEnter your password to register new account", "Register", "Cancle");
}
if(INI_Open(getINI(playerid)))
{
INI_WriteInt("Password", sizeof(inputtext));
INI_WriteInt("Score",1);
INI_WriteInt("Cash",0);
INI_WriteInt("Admin",0);
INI_WriteInt("Kills",0);
INI_WriteInt("Deaths",0);
INI_Save();
INI_Close();
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Type your password to login", "Login", "Cancle");
}
}
}
case DIALOG_LOGIN:
{
if (!response) return Kick (playerid);
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login","{FF0000}You have entered an invalid password.\nType your password below to login.","Login","Quit");
}
if(INI_Open(getINI(playerid)))
{
INI_ReadString(PlayerInfo[playerid][pPass],"Password",20);
if(strcmp(inputtext,PlayerInfo[playerid][pPass],false))
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login","{FF0000}You have entered an incorrect password.\nType your password below to login.","Login","Quit");
}
SetPlayerScore(playerid,INI_ReadInt("Score"));
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,INI_ReadInt("Cash"));
INI_Close();
}
}
}
}
return 1;
}

Is there any thing like SetPlayerKills and deaths?

Rudy_
19/06/2012, 01:34 PM
Ehm.. i need it.
ASAP.
sorry
4
da
bad
bump
:S

Skaizo
19/06/2012, 01:37 PM
//at top of script
#define PATH "/Users/%s.ini"

//PlayerInfo
enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];


//Create function LoadUser
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("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
return 1;
}

//stock
stock udb_hash(buf[]) {
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}

stock getINI(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playernam e));
format(string,sizeof(string),PATH,playername);
return string;
}

//OnPlayerConnect
public OnPlayerConnect(playerid)
{
if(fexist(getINI(playerid)))
{
INI_ParseFile(getINI(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "{FF0000}""Login", "Enter your {FF0000}Password {FFFFFF}To Login", "Login", "Cancle");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", "{FFFFFF}Enter your {FF0000}Password {FFFFFF}To register new account", "Register", "Cancle");
}
return 1;
}

//OnDialogResponse
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch (dialogid)
{
case DIALOG_REGISTER:
{
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", "{FF0000}You have entered wrong password\nEnter your password to register new account", "Register", "Cancle");
if(INI_Open(getINI(playerid)))
{
new INI:File = INI_Open(getINI(playerid));
INI_WriteInt("Password", sizeof(inputtext));
INI_WriteInt("Score",1);
INI_WriteInt("Cash",0);
INI_WriteInt("Admin",0);
INI_WriteInt("Kills",0);
INI_WriteInt("Deaths",0);
INI_Save();
INI_Close();
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Type your password to login", "Login", "Cancle");
}
}

}
case DIALOG_LOGIN:
{
if (!response) return Kick(playerid);
if(response)
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_MSGBOX,"Success!", "{FF0000}You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login", "{FF0000}You have entered wrong password\nEnter your password to Login in", "Login", "Quit");
}
}
}
return 1;
}

//OnPlayerDissconect
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(getINI(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
return 1;
}
//OnPlayerDeath
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
return 1;
}

Rudy_
19/06/2012, 01:38 PM
I already know how to make with Y_ini
i'm trying with SII for first time
and can't fix this error and i need it urgent

Rudy_
19/06/2012, 02:28 PM
Anyone want to help me? or not? please :L

MadeMan
19/06/2012, 02:32 PM
Does it create the userfile in scriptfiles folder after you register?

Rudy_
19/06/2012, 02:43 PM
Hm.
I checked scriptfiles and there wasn't any folder like Users or anything like that.
Do i have to add something like "INI_WriteInt(File,"data");" ?
because i don't have it

if(INI_Open(getINI(playerid)))
{
INI_WriteString("Password",inputtext);
INI_WriteInt("Score",1);
INI_WriteInt("Cash",0);
INI_WriteInt("Admin",0);
INI_WriteInt("Kills",0);
INI_WriteInt("Deaths",0);
INI_Save();
INI_Close();

MadeMan
19/06/2012, 02:58 PM
Where should it create the userfile?

Rudy_
19/06/2012, 03:02 PM
stock getINI(playerid)
{
new account[64];
format(account,30,"Users/%s.ini",gPlayerName[playerid]); //here?
return account;
}

MadeMan
19/06/2012, 03:03 PM
You need to create the Users folder.

Rudy_
19/06/2012, 03:04 PM
Under OnPlayerConnect?

MadeMan
19/06/2012, 03:05 PM
No, create it manually.

Rudy_
19/06/2012, 03:07 PM
It's working nvm fixed the Deaths problem

Rudy_
19/06/2012, 03:15 PM
damn
it only Saves account
Password=(This)
it don't save Score,cash admin and kills
Score=1
Cash=0
Admin=0
Kills=0
Deaths=0

[MM]RoXoR[FS]
19/06/2012, 03:22 PM
Show your OnPlayerDisconnect

Rudy_
19/06/2012, 03:24 PM
public OnPlayerDisconnect(playerid, reason)
{
if(INI_Open(getINI(playerid)))
INI_WriteInt("Score",PlayerInfo[playerid][pScore]);
INI_WriteInt("Cash",GetPlayerMoney(playerid));
INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt("Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt("Kills",PlayerInfo[playerid][pKills]);
return 1;
}

Rudy_
19/06/2012, 03:34 PM
what's wrong?Who can help me?

OT: i have accidently set my IE zoom to larger anyone know how to set it to 100?