[Help] Error in DOF2
#1

Before I would like to point out that I am learning with DOF2, I read most of the topics about it, but I still do not know how to use it perfectly, my problem is as follows.

I have a system on my server, depending on your score a specific skill is enabled, I did a check with a simple variable (ClassIde) in which I store numbers from 1 to 12, which is the amount of skills you have, then for example, such a skill can only be used if ClassId == 6, and ClassId only turns 6 when you reach 600 of score.

Basically that's it, my problem comes now, the player can only use one skill, but you can choose between them (as long as you have unlocked), so I saved the value of these varibles, with a few more strings, like the skill name in a database DOF2, so every time the player spawns, it saves the value of (ClassIde), so that when login again continue the same.

So these are the codes:

PHP код:
// Under "OnPlayerConnect" to set the saved value when connecting
    
new ClasseSystem[200], jogador[MAX_PLAYER_NAME];
    
GetPlayerName(playeridjogadorsizeof(jogador));
     
format(ClasseSystemsizeof(ClasseSystem), "CLASSES/%s.ini"jogador);
    if(
DOF2_FileExists(ClasseSystem))
    {
        
CLASSEide[playerid]     = DOF2_GetInt(ClasseSystem"ClassId");        
        
SetPlayerColor(playeridDOF2_GetString(ClasseSystem"NameColor");
        
checadorCLASSE[playerid][1] = DOF2_GetBool(ClasseSystem"Checagem1");
        
checadorCLASSE[playerid][2] = DOF2_GetBool(ClasseSystem"Checagem2");
        
checadorCLASSE[playerid][3] = DOF2_GetBool(ClasseSystem"Checagem3");
        
checadorCLASSE[playerid][4] = DOF2_GetBool(ClasseSystem"Checagem4");
        
checadorCLASSE[playerid][5] = DOF2_GetBool(ClasseSystem"Checagem5");
        
checadorCLASSE[playerid][6] = DOF2_GetBool(ClasseSystem"Checagem6");
        
checadorCLASSE[playerid][7] = DOF2_GetBool(ClasseSystem"Checagem7");
        
checadorCLASSE[playerid][8] = DOF2_GetBool(ClasseSystem"Checagem8");
        
checadorCLASSE[playerid][9] = DOF2_GetBool(ClasseSystem"Checagem9");
        
checadorCLASSE[playerid][10] = DOF2_GetBool(ClasseSystem"Checagem10");
        
checadorCLASSE[playerid][11] = DOF2_GetBool(ClasseSystem"Checagem11");
        
checadorCLASSE[playerid][12] = DOF2_GetBool(ClasseSystem"Checagem12");
    }
    else
    {
        
DOF2_CreateFile(ClasseSystem);
    } 
PHP код:
// Under "OnPlayerSpawn" to save the value in every spawn
    // This TXD is to show the skill name, who is saved in DOF2 too
    
PlayerTextDrawShow(playeridsobrevivente[playerid]);
    new 
formated[250];
    
format(formatedsizeof(formated), "%s"DOF2_GetString(ClasseSystem"RankName",);
    
PlayerTextDrawSetString(playeridsobrevivente[playerid], formated);
    if(
CLASSEide == 1)
    {
        if(
DOF2_FileExists(ClasseSystem))
        {
            
DOF2_SetBool(ClasseSystem"Checagem1"checadorCLASSE[playerid][1]);
            
DOF2_SetString(ClasseSystem"RankName""Sobrevivente");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        else
        {
            
DOF2_SetBool(ClasseSystem"Checagem1"checadorCLASSE[playerid][1]);
            
DOF2_SetString(ClasseSystem"RankName""Sobrevivente");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        }
    }
    if(
CLASSEide == 2)
    {
        if(
DOF2_FileExists(ClasseSystem))
        {
            
DOF2_SetString(ClasseSystem"NameColor""0xFAA6FFFF");
            
DOF2_SetBool(ClasseSystem"Checagem2"checadorCLASSE[playerid][2]);
            
DOF2_SetString(ClasseSystem"RankName""Medico");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        else
        {
            
DOF2_SetString(ClasseSystem"NameColor""0xFAA6FFFF");
            
DOF2_SetBool(ClasseSystem"Checagem2"checadorCLASSE[playerid][2]);
            
DOF2_SetString(ClasseSystem"RankName""Medico");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        }
    }
    if(
CLASSEide == 3)
    {
        if(
DOF2_FileExists(ClasseSystem))
        {
            
DOF2_SetString(ClasseSystem"NameColor""0x6DFF4CFF");
            
DOF2_SetBool(ClasseSystem"Checagem3"checadorCLASSE[playerid][3]);
            
DOF2_SetString(ClasseSystem"RankName""Engenheiro");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        else
        {
            
DOF2_SetString(ClasseSystem"NameColor""0x6DFF4CFF");
            
DOF2_SetBool(ClasseSystem"Checagem3"checadorCLASSE[playerid][3]);
            
DOF2_SetString(ClasseSystem"RankName""Engenheiro");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        }
    }
    if(
CLASSEide == 4)
    {
        if(
DOF2_FileExists(ClasseSystem))
        {
            
DOF2_SetString(ClasseSystem"NameColor""0x00EEACFF");
            
DOF2_SetBool(ClasseSystem"Checagem4"checadorCLASSE[playerid][4]);
            
DOF2_SetString(ClasseSystem"RankName""Ladrao");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        else
        {
            
DOF2_SetString(ClasseSystem"NameColor""0x00EEACFF");
            
DOF2_SetBool(ClasseSystem"Checagem4"checadorCLASSE[playerid][4]);
            
DOF2_SetString(ClasseSystem"RankName""Ladrao");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        }
    }
    if(
CLASSEide == 5)
    {
        if(
DOF2_FileExists(ClasseSystem))
        {
            
DOF2_SetString(ClasseSystem"NameColor""0xFF0000FF");
            
DOF2_SetBool(ClasseSystem"Checagem5"checadorCLASSE[playerid][5]);
            
DOF2_SetString(ClasseSystem"RankName""Terrorista");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        else
        {
            
DOF2_SetString(ClasseSystem"NameColor""0xFF0000FF");
            
DOF2_SetBool(ClasseSystem"Checagem5"checadorCLASSE[playerid][5]);
            
DOF2_SetString(ClasseSystem"RankName""Terrorista");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        }
    }
    if(
CLASSEide == 6)
    {
        if(
DOF2_FileExists(ClasseSystem))
        {
            
DOF2_SetString(ClasseSystem"NameColor""0x7263A5FF");
            
DOF2_SetBool(ClasseSystem"Checagem6"checadorCLASSE[playerid][6]);
            
DOF2_SetString(ClasseSystem"RankName""Pistoleiro");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        else
        {
            
DOF2_SetString(ClasseSystem"NameColor""0x7263A5FF");
            
DOF2_SetBool(ClasseSystem"Checagem6"checadorCLASSE[playerid][6]);
            
DOF2_SetString(ClasseSystem"RankName""Pistoleiro");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        }
    }
    if(
CLASSEide == 7)
    {
        if(
DOF2_FileExists(ClasseSystem))
        {
            
DOF2_SetString(ClasseSystem"NameColor""0xFFDB00FF");
            
DOF2_SetBool(ClasseSystem"Checagem7"checadorCLASSE[playerid][7]);
            
DOF2_SetString(ClasseSystem"RankName""Mercenario");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        else
        {
            
DOF2_SetString(ClasseSystem"NameColor""0xFFDB00FF");
            
DOF2_SetBool(ClasseSystem"Checagem7"checadorCLASSE[playerid][7]);
            
DOF2_SetString(ClasseSystem"RankName""Mercenario");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        }
    }
    if(
CLASSEide == 8)
    {
        if(
DOF2_FileExists(ClasseSystem))
        {
            
DOF2_SetString(ClasseSystem"NameColor""0x5FAAFFFF");
            
DOF2_SetBool(ClasseSystem"Checagem8"checadorCLASSE[playerid][8]);
            
DOF2_SetString(ClasseSystem"RankName""Mecanico");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        else
        {
            
DOF2_SetString(ClasseSystem"NameColor""0x5FAAFFFF");
            
DOF2_SetBool(ClasseSystem"Checagem8"checadorCLASSE[playerid][8]);
            
DOF2_SetString(ClasseSystem"RankName""Mecanico");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        }
    }
    if(
CLASSEide == 9)
    {
        if(
DOF2_FileExists(ClasseSystem))
        {
            
DOF2_SetString(ClasseSystem"NameColor""0xFF7400FF");
            
DOF2_SetBool(ClasseSystem"Checagem9"checadorCLASSE[playerid][9]);
            
DOF2_SetString(ClasseSystem"RankName""Assassino");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        else
        {
            
DOF2_SetString(ClasseSystem"NameColor""0xFF7400FF");
            
DOF2_SetBool(ClasseSystem"Checagem9"checadorCLASSE[playerid][9]);
            
DOF2_SetString(ClasseSystem"RankName""Assassino");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        }
    }
    if(
CLASSEide == 10)
    {
        if(
DOF2_FileExists(ClasseSystem))
        {
            
DOF2_SetString(ClasseSystem"NameColor""0x005A18FF");
            
DOF2_SetBool(ClasseSystem"Checagem20"checadorCLASSE[playerid][20]);
            
DOF2_SetString(ClasseSystem"RankName""Militar");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        else
        {
            
DOF2_SetString(ClasseSystem"NameColor""0x005A18FF");
            
DOF2_SetBool(ClasseSystem"Checagem10"checadorCLASSE[playerid][10]);
            
DOF2_SetString(ClasseSystem"RankName""Militar");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        }
    }
    if(
CLASSEide == 11)
    {
        if(
DOF2_FileExists(ClasseSystem))
        {
            
DOF2_SetString(ClasseSystem"NameColor""0x0034A3FF");
            
DOF2_SetBool(ClasseSystem"Checagem11"checadorCLASSE[playerid][11]);
            
DOF2_SetString(ClasseSystem"RankName""Cacador");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        else
        {
            
DOF2_SetString(ClasseSystem"NameColor""0x0034A3FF");
            
DOF2_SetBool(ClasseSystem"Checagem11"checadorCLASSE[playerid][11]);
            
DOF2_SetString(ClasseSystem"RankName""Cacador");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        }
    }
    if(
CLASSEide == 12)
    {
        if(
DOF2_FileExists(ClasseSystem))
        {
            
DOF2_SetString(ClasseSystem"NameColor""0xA200FFFF");
            
DOF2_SetBool(ClasseSystem"Checagem12"checadorCLASSE[playerid][12]);
            
DOF2_SetString(ClasseSystem"RankName""Lendario");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        else
        {
            
DOF2_SetString(ClasseSystem"NameColor""0xA200FFFF");
            
DOF2_SetBool(ClasseSystem"Checagem12"checadorCLASSE[playerid][12]);
            
DOF2_SetString(ClasseSystem"RankName""Lendario");
            
DOF2_SetInt(ClasseSystem"ClassId"CLASSEide[playerid]);
            
DOF2_SaveFile();
        }
    } 
But I think I did it wrong, I think not, I'm sure, because by putting this, GM does not compile, it gives an error in GM's own file and followed this comes a lot of countless errors, then something is wrong, just not I know what it is, can anyone help me?

Sorry if this got a little long
Reply


Messages In This Thread
[Help] Error in DOF2 - by ApolloScripter - 07.12.2018, 15:12
Re: [Help] Error in DOF2 - by Logic_ - 07.12.2018, 15:48
Re: [Help] Error in DOF2 - by ApolloScripter - 07.12.2018, 16:04
Re: [Help] Error in DOF2 - by ApolloScripter - 07.12.2018, 20:42

Forum Jump:


Users browsing this thread: 1 Guest(s)