A big problem
#1

Hello. I have this errors on the callback OnPlayerLogin and i don't know what to do it. Please help me
This are the errors:
PHP код:
\gamemodes\game.pwn(3405) : error 017undefined symbol "ini_GetKey"
\gamemodes\game.pwn(3405) : error 033: array must be indexed (variable "keytmp")
\
gamemodes\game.pwn(3408) : error 017undefined symbol "ini_GetValue"
\gamemodes\game.pwn(3408) : error 033: array must be indexed (variable "valtmp")
\
gamemodes\game.pwn(3418) : error 017undefined symbol "ini_GetKey"
\gamemodes\game.pwn(3418) : error 033: array must be indexed (variable "key")
\
gamemodes\game.pwn(3421) : error 017undefined symbol "ini_GetValue"
\gamemodes\game.pwn(3421) : error 033: array must be indexed (variable "val")
\
gamemodes\game.pwn(3426) : error 017undefined symbol "ini_GetValue"
\gamemodes\game.pwn(3426) : error 033: array must be indexed (variable "val")
\
gamemodes\game.pwn(3431) : error 017undefined symbol "ini_GetValue"
\gamemodes\game.pwn(3431) : error 033: array must be indexed (variable "val")
\
gamemodes\game.pwn(3436) : error 017undefined symbol "ini_GetValue"
\gamemodes\game.pwn(3436) : error 033: array must be indexed (variable "val")
\
gamemodes\game.pwn(3441) : error 017undefined symbol "ini_GetValue"
\gamemodes\game.pwn(3441) : error 033: array must be indexed (variable "val")
\
gamemodes\game.pwn(3446) : error 017undefined symbol "ini_GetValue"
\gamemodes\game.pwn(3446) : error 033: array must be indexed (variable "val")
\
gamemodes\game.pwn(3451) : error 017undefined symbol "ini_GetValue"
\gamemodes\game.pwn(3451) : error 033: array must be indexed (variable "val")
\
gamemodes\game.pwn(3456) : error 017undefined symbol "ini_GetValue"
\gamemodes\game.pwn(3456) : error 033: array must be indexed (variable "val")
\
gamemodes\game.pwn(3461) : error 017undefined symbol "ini_GetValue"
\gamemodes\game.pwn(3461) : error 033: array must be indexed (variable "val")
\
gamemodes\game.pwn(3466) : error 017undefined symbol "ini_GetValue"
\gamemodes\game.pwn(3466) : error 033: array must be indexed (variable "val"
and this is the script where are the problems
PHP код:
public OnPlayerLogin(playerid,password[])
{
    if(
IsPlayerNPC(playerid)) return SpawnPlayer(playerid);
    if(
IsPlayerNPC(playerid)) return 1;
    new 
tmp2[256];
    new 
string2[64];
    new 
playername2[MAX_PLAYER_NAME];
    new 
playernamesplit[3][MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayername2sizeof(playername2));
    
split(playername2playernamesplit'_');
    
format(string2sizeof(string2), "Jucători/%s.ini"playername2);
    new 
FileUserFile fopen(string2io_read);
    if (
UserFile)
    {
        new 
PassData[256];
        new 
keytmp[256];
        new 
valtmp[256];
        
fread(UserFilePassDatasizeof(PassData));
        
keytmp ini_GetKey(PassData);
        if(
strcmp(keytmp"Password"true) == 0)
        {
            
valtmp ini_GetValue(PassData);
            
strmid(PlayerInfo[playerid][pPass], valtmp0strlen(valtmp)-1255);
        }
        if(
strcmp(PlayerInfo[playerid][pPass],passwordtrue) == 0)
        {
                new 
key[256];
                new 
val[256];
                new 
Data[256];
                while (
fread(UserFile Datasizeof(Data)))
                {
                    
key ini_GetKey(Data);
                    if(
strcmp(key"Money"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pCash] = strval(val);
                    }
                    if(
strcmp(key"Muted"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pMuted] = strval(val);
                    }
                    if(
strcmp(key"Level"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pLevel] = strval(val);
                    }
                    if(
strcmp(key"Respect"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pExp] = strval(val);
                    }
                    if(
strcmp(key"Sex"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pSex] = strval(val);
                    }
                    if(
strcmp(key"Origin"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pOrigin] = strval(val);
                    }
                    if(
strcmp(key"Age"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pAge] = strval(val);
                    }
                    if(
strcmp(key"Admin"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pAdmin] = strval(val);
                    }
                    if(
strcmp(key"Kills"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pKills] = strval(val);
                    }
                    if(
strcmp(key"Deaths"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pDeaths] = strval(val);
                    }
                    if(
strcmp(key"Jailed"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pJailed] = strval(val);
                    }
                    if(
strcmp(key"Model"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pModel] = strval(val);
                    }
                    if(
strcmp(key"Tutorial"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pTutorial] = strval(val);
                    }
                    if(
strcmp(key"Оnregistrat"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pReg] = strval(val);
                    }
                    if(
strcmp(key"Int"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pInt] = strval(val);
                    }
                    if(
strcmp(key"Local"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pLocal] = strval(val);
                    }
                    if(
strcmp(key "Char"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pChar] = strval(val);
                    }
                    if(
strcmp(key"FacingAngle"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pFacingAngle] = floatstr(val);
                    }
                    if(
strcmp(key"Health"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pHealth] = floatstr(val);
                    }
                    if(
strcmp(key"Armour"true) == 0)
                    {
                        
val ini_GetValue(Data);
                        
PlayerInfo[playerid][pArmour] = floatstr(val);
                    }
                }
                
fclose(UserFile);
        }
        else
        {
            
ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"{FFFFFF}Login""{FFFFFF}Aceasta parola nu este corecta. Mai оncearcă o dată:" ,"{FFFFFF}Login""{FFFFFF}Exit");
            
fclose(UserFile);
            
gPlayerLogTries[playerid] += 1;
            if(
gPlayerLogTries[playerid] == 3)
            {
                
SendClientMessage(playeridCOLOR_WHITE"{FA8072}ConsolaJucator: {FFFFFF} Ai luat kick pentru ca ai bagat parola de 3 ori gresita !");
                
Kick(playerid);
            }
            return 
1;
        }
        if(
PlayerInfo[playerid][pAdmin] >= 1)
        {
            
format(tmp2sizeof(tmp2), "{FA8072}ConsolaJucator: {FFFFFF}Te-ai conectat cu level {006400}%d {FFFFFF}admin.",PlayerInfo[playerid][pAdmin]);
            
SendClientMessage(playeridCOLOR_WHITE,tmp2);
        }
        if(
PlayerInfo[playerid][pLevel] == -999)
        {
            
SendClientMessage(playeridCOLOR_GREEN"{FA8072}ConsolaJucator: {FFFFFF} Esti banat pe acest SERVER!"); // 1
            
Ban(playerid);
        }
        if(
PlayerInfo[playerid][pReg] == 0)
        {
            
PlayerInfo[playerid][pLevel] = 1;
            
PlayerInfo[playerid][pExp] = 0;
            
PlayerInfo[playerid][pHealth] = 50.0;
            
PlayerInfo[playerid][pInt] = 15;
            
PlayerInfo[playerid][pLocal] = 255;
            
PlayerInfo[playerid][pModel] = 60;
            
PlayerInfo[playerid][pReg] = 1;
            
GivePlayerMoneyEx(playerid50000);
        }
        
format(tmp2sizeof(tmp2), "~w~bine ai venit ~n~~b~   %s"GetName(playerid));
        
GameTextForPlayer(playeridtmp250001);
        
GivePlayerMoneyEx(playeridPlayerInfo[playerid][pCash]);
          
SetPlayerSkin(playeridPlayerInfo[playerid][pModel]);
          
SetPlayerScore(playeridPlayerInfo[playerid][pLevel]);
        
SetPlayerHealth(playeridPlayerInfo[playerid][pHealth]);
        
SetPlayerArmour(playeridPlayerInfo[playerid][pArmour]);
        
SetPlayerInterior(playeridPlayerInfo[playerid][pInt]);
        
SetPlayerVirtualWorld(playerid0);
        
SetCameraBehindPlayer(playerid);
        
ResetPlayerWeapons(playerid);
        
SetSpawnInfo(playerid0PlayerInfo[playerid][pChar], 1964.8954, -1305.2051 ,53.455990000000);
    }
    return 
1;

Reply
#2

ini_GetKey and ini_GetValue are undefined.
Reply
#3

They are defined
look
PHP код:
stock ini_GetKey(line[])
{
    new 
keyRes[256];
    
keyRes[0] = 0;
    if(
strfind(line"=" true) == -1) return keyRes;
    
strmid(keyResline0strfind(line"="true),sizeof(keyRes));
    return 
keyRes;
}

stock ini_GetValueline[] )
{
    new 
valRes[256];
    
valRes[0]=0;
    if(
strfind(line"="true) == -1) return valRes;
    
strmid(valReslinestrfind(line"="true)+1,strlen(line),sizeof(valRes));
    return 
valRes;

Reply
#4

try to change
pawn Код:
keytmp = ini_GetKey(PassData);
to
pawn Код:
format(keytmp,sizeof(keytmp),"%s",ini_GetKey(PassData);
and do the same for valtmp,key,val too.
Reply
#5

Can you do this for me please ? I will appreciate with a rep+
Reply
#6

here you are:
pawn Код:
public OnPlayerLogin(playerid,password[])
{
    if(IsPlayerNPC(playerid)) return SpawnPlayer(playerid);
    if(IsPlayerNPC(playerid)) return 1;
    new tmp2[256];
    new string2[64];
    new playername2[MAX_PLAYER_NAME];
    new playernamesplit[3][MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    split(playername2, playernamesplit, '_');
    format(string2, sizeof(string2), "Jucatori/%s.ini", playername2);
    new File: UserFile = fopen(string2, io_read);
    if (UserFile)
    {
        new PassData[256];
        new keytmp[256];
        new valtmp[256];
        fread(UserFile, PassData, sizeof(PassData));
        format(keytmp,sizeof(keytmp),"%s",ini_GetKey(PassData));
        if(strcmp(keytmp, "Password", true) == 0)
        {
            format(valtmp,sizeof(valtmp),"%s",ini_GetValue(PassData));
            strmid(PlayerInfo[playerid][pPass], valtmp, 0, strlen(valtmp)-1, 255);
        }
        if(strcmp(PlayerInfo[playerid][pPass],password, true) == 0)
        {
                new key[256];
                new val[256];
                new Data[256];
                while (fread(UserFile , Data, sizeof(Data)))
                {
                    format(key,sizeof(key),"%s",ini_GetKey(Data));
                    if(strcmp(key, "Money", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pCash] = strval(val);
                    }
                    if(strcmp(key, "Muted", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pMuted] = strval(val);
                    }
                    if(strcmp(key, "Level", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pLevel] = strval(val);
                    }
                    if(strcmp(key, "Respect", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pExp] = strval(val);
                    }
                    if(strcmp(key, "Sex", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pSex] = strval(val);
                    }
                    if(strcmp(key, "Origin", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pOrigin] = strval(val);
                    }
                    if(strcmp(key, "Age", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pAge] = strval(val);
                    }
                    if(strcmp(key, "Admin", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pAdmin] = strval(val);
                    }
                    if(strcmp(key, "Kills", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pKills] = strval(val);
                    }
                    if(strcmp(key, "Deaths", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pDeaths] = strval(val);
                    }
                    if(strcmp(key, "Jailed", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pJailed] = strval(val);
                    }
                    if(strcmp(key, "Model", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pModel] = strval(val);
                    }
                    if(strcmp(key, "Tutorial", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pTutorial] = strval(val);
                    }
                    if(strcmp(key, "Оnregistrat", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pReg] = strval(val);
                    }
                    if(strcmp(key, "Int", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pInt] = strval(val);
                    }
                    if(strcmp(key, "Local", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pLocal] = strval(val);
                    }
                    if(strcmp(key , "Char", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pChar] = strval(val);
                    }
                    if(strcmp(key, "FacingAngle", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pFacingAngle] = floatstr(val);
                    }
                    if(strcmp(key, "Health", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pHealth] = floatstr(val);
                    }
                    if(strcmp(key, "Armour", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pArmour] = floatstr(val);
                    }
                }
                fclose(UserFile);
        }
        else
        {
            ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"{FFFFFF}Login", "{FFFFFF}Aceasta parola nu este corecta. Mai оncearca o data:" ,"{FFFFFF}Login", "{FFFFFF}Exit");
            fclose(UserFile);
            gPlayerLogTries[playerid] += 1;
            if(gPlayerLogTries[playerid] == 3)
            {
                SendClientMessage(playerid, COLOR_WHITE, "{FA8072}ConsolaJucator: {FFFFFF} Ai luat kick pentru ca ai bagat parola de 3 ori gresita !");
                Kick(playerid);
            }
            return 1;
        }
        if(PlayerInfo[playerid][pAdmin] >= 1)
        {
            format(tmp2, sizeof(tmp2), "{FA8072}ConsolaJucator: {FFFFFF}Te-ai conectat cu level {006400}%d {FFFFFF}admin.",PlayerInfo[playerid][pAdmin]);
            SendClientMessage(playerid, COLOR_WHITE,tmp2);
        }
        if(PlayerInfo[playerid][pLevel] == -999)
        {
            SendClientMessage(playerid, COLOR_GREEN, "{FA8072}ConsolaJucator: {FFFFFF} Esti banat pe acest SERVER!"); // 1
            Ban(playerid);
        }
        if(PlayerInfo[playerid][pReg] == 0)
        {
            PlayerInfo[playerid][pLevel] = 1;
            PlayerInfo[playerid][pExp] = 0;
            PlayerInfo[playerid][pHealth] = 50.0;
            PlayerInfo[playerid][pInt] = 15;
            PlayerInfo[playerid][pLocal] = 255;
            PlayerInfo[playerid][pModel] = 60;
            PlayerInfo[playerid][pReg] = 1;
            GivePlayerMoneyEx(playerid, 50000);
        }
        format(tmp2, sizeof(tmp2), "~w~bine ai venit ~n~~b~   %s", GetName(playerid));
        GameTextForPlayer(playerid, tmp2, 5000, 1);
        GivePlayerMoneyEx(playerid, PlayerInfo[playerid][pCash]);
          SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
          SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
        SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
        SetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
        SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
        SetPlayerVirtualWorld(playerid, 0);
        SetCameraBehindPlayer(playerid);
        ResetPlayerWeapons(playerid);
        SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pChar], 1964.8954, -1305.2051 ,53.4559, 90, 0, 0, 0, 0, 0, 0);
    }
    return 1;
}
Reply
#7

thx man but i still got error on this:
PHP код:
error 017undefined symbol "ini_GetKey"
and this
error 017
undefined symbol "ini_GetValue" 
Reply
#8

where did you put those?

pawn Код:
stock ini_GetKey(line[])
{
    new keyRes[256];
    keyRes[0] = 0;
    if(strfind(line, "=" , true) == -1) return keyRes;
    strmid(keyRes, line, 0, strfind(line, "=", true),sizeof(keyRes));
    return keyRes;
}

stock ini_GetValue( line[] )
{
    new valRes[256];
    valRes[0]=0;
    if(strfind(line, "=", true) == -1) return valRes;
    strmid(valRes, line, strfind(line, "=", true)+1,strlen(line),sizeof(valRes));
    return valRes;
}
?
Reply
#9

at last line
Reply
#10

Can you try to put it before public OnPlayerLogin please?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)