PDA

View Full Version : Error


Jigsaw123
29/07/2015, 08:14 PM
Hey guys.. I have this problem that when I register, I put in password, gender, age, everything, and I spawn (Not at the spawn that i set, but some spawn in los santos), but when I log off and log on again it asks me for gender and everything again but it saves money and everything else.

I also get this warning at the REGISTER DIALOG:

if(dialogid == 2) //REGISTER
{
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are already logged in.");
return 1;
}
if(response)
{
if(strlen(inputtext) >= 50)
{
DisplayDialogForPlayer(playerid, 2); //register
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Password is too long.");
return 0;
}
if(!strlen(inputtext))
{
DisplayDialogForPlayer(playerid, 2); //register
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You must enter a password.");
return 1;
}
new sendername[MAX_PLAYER_NAME];
new string[128];
format(string, sizeof(string), "Users/%s.ini", sendername);
if(fexist(string))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[C-RP]{FFFFFF} That name is already taken, please choose a different one.");
return 1;
}
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
Encrypt(tmppass);
OnPlayerRegister(playerid,tmppass);
OnPlayerLogin(playerid,tmppass);
gPlayerAccount[playerid] = 1;
gPlayerSpawned[playerid] = 1;
SpawnPlayer(playerid);
}
else
{
DisplayDialogForPlayer(playerid, 2); //register
}
}


MY WARNING:

C:\Users\Gabriel\Documents\Coding\Server1\gamemode s\UG-RP.pwn(21181) : warning 219: local variable "string" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.

Moudix
29/07/2015, 08:42 PM
Probably you have "new string" on top , so you have defined string 2x. Replace it with ;
if(dialogid == 2) //REGISTER
{
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are already logged in.");
return 1;
}
if(response)
{
if(strlen(inputtext) >= 50)
{
DisplayDialogForPlayer(playerid, 2); //register
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Password is too long.");
return 0;
}
if(!strlen(inputtext))
{
DisplayDialogForPlayer(playerid, 2); //register
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You must enter a password.");
return 1;
}
new sendername[MAX_PLAYER_NAME];
new string2[128];
format(string2, sizeof(string2), "Users/%s.ini", sendername);
if(fexist(string2))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[C-RP]{FFFFFF} That name is already taken, please choose a different one.");
return 1;
}
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
Encrypt(tmppass);
OnPlayerRegister(playerid,tmppass);
OnPlayerLogin(playerid,tmppass);
gPlayerAccount[playerid] = 1;
gPlayerSpawned[playerid] = 1;
SpawnPlayer(playerid);
}
else
{
DisplayDialogForPlayer(playerid, 2); //register
}
}