Invalid/unsupported p-code file format
#1

Hi! I have an problem. If I compile my GM, the compiler crashes and when i start my server, it says invalid/unsupported p-code file format.

This is the script what i added:
pawn Код:
if(strcmp(cmd, "/warn", true )== 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                return SendClientMessage(playerid, COLOR_GREY, " VIGA: Sa ei ole sisse logitud. ");

                if(PlayerInfo[playerid][pAdmin] < 1)
                    return SendClientMessage(playerid, COLOR_GREY, " VIGA: Ainult adminid vхivad seda kдsklust kasutada. ");

            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {

                SendClientMessage( playerid, COLOR_GRAD2, " DEBUG: /hoiata <ID/NIMI> <Pхhjus> ");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid))
            {

                    if( giveplayerid != INVALID_PLAYER_ID )
                    {
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ''))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SendClientMessage( playerid, COLOR_GRAD2, " DEBUG: /hoiata <ID/NIMI> <Pхhjus>");
                            return 1;
                        }
                        PlayerInfo[giveplayerid][pWarns] ++;
                        if(PlayerInfo[giveplayerid][pWarns] >= 5)
                        {
                            PlayerInfo[playerid][pLocked] = 2;
                            SendClientMessage(playerid, COLOR_LIGHTRED, "Sa said banni, sest sul tдitusid 5 hoiatust.");
                            Ban(giveplayerid);
                            return 1;
                        }
                        format(string, sizeof(string), "Admin %s hoiatas sind. Pхhjus: %s. ", sendername, result);
                        SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
                        format(string, sizeof(string), "Sa hoiatasid %s'i. Pхhjus: %s.", giveplayer, result);
                        SendClientMessage(playerid, COLOR_LIGHTRED, string);
                        return 1;
                    }
            }
        }
        return 1;
    }
}
The enums are working and if i edit the Warnings= from ini file, it works too but it doesnt ban, tho.
Reply
#2

PHP код:
if(strcmp(cmd"/warn"true )== 0)
    {
        if(
IsPlayerConnected(playerid))
        {
       
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessageplayeridCOLOR_GRAD2" DEBUG: /hoiata <ID/NIMI> <Pхhjus> ");
                return 
1;
            }
            if(
gPlayerLogged[playerid] == 0)
            {
                
SendClientMessage(playeridCOLOR_GREY" VIGA: Sa ei ole sisse logitud. ");
                return 
1;
                }
                if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playeridCOLOR_GREY" VIGA: Ainult adminid vхivad seda kдsklust kasutada. ");
            
            
giveplayerid ReturnUser(tmp);
            if(
IsPlayerConnected(giveplayerid))
            {
                    if( 
giveplayerid != INVALID_PLAYER_ID )
                    {
                        
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                        
GetPlayerName(playeridsendernamesizeof(sendername));
                        new 
length strlen(cmdtext);
                        while ((
idx length) && (cmdtext[idx] <= ''))
                        {
                            
idx++;
                        }
                        new 
offset idx;
                        new 
result[64];
                        while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
                        {
                            
result[idx offset] = cmdtext[idx];
                            
idx++;
                        }
                        
result[idx offset] = EOS;
                        if(!
strlen(result))
                        {
                            
SendClientMessageplayeridCOLOR_GRAD2" DEBUG: /hoiata <ID/NIMI> <Pхhjus>");
                            return 
1;
                        }
                        
PlayerInfo[giveplayerid][pWarns] ++;
                        if(
PlayerInfo[giveplayerid][pWarns] >= 5)
                        {
                            
PlayerInfo[playerid][pLocked] = 2;
                            
SendClientMessage(playeridCOLOR_LIGHTRED"Sa said banni, sest sul tдitusid 5 hoiatust.");
                            
Ban(giveplayerid);
                            return 
1;
                        }
                        
format(stringsizeof(string), "Admin %s hoiatas sind. Pхhjus: %s. "sendernameresult);
                        
SendClientMessage(giveplayeridCOLOR_LIGHTREDstring);
                        
format(stringsizeof(string), "Sa hoiatasid %s'i. Pхhjus: %s."giveplayerresult);
                        
SendClientMessage(playeridCOLOR_LIGHTREDstring);
                        return 
1;
                    }
            }
        }
        return 
1;
    }

Try this
Reply
#3

Still crashes. ;<
Reply
#4

PHP код:
if(strcmp(cmd"/warn"true )== 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessageplayeridCOLOR_GRAD2" DEBUG: /hoiata <ID/NIMI> <Pohjus> ");
                return 
1;
            }
            if(
gPlayerLogged[playerid] == 0)
            {
                
SendClientMessage(playeridCOLOR_GREY" VIGA: Sa ei ole sisse logitud. ");
                return 
1;
                }
                if(
PlayerInfo[playerid][pAdmin] < 1);
                {
                  
SendClientMessage(playeridCOLOR_GREY" VIGA: Ainult adminid voivad seda kasklust kasutada. ");
                  
giveplayerid ReturnUser(tmp);
                  }
                 if(
IsPlayerConnected(giveplayerid))
                 {
                    if( 
giveplayerid != INVALID_PLAYER_ID )
                    {
                        
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                        
GetPlayerName(playeridsendernamesizeof(sendername));
                        new 
length strlen(cmdtext);
                        while ((
idx length) && (cmdtext[idx] <= ''))
                        {
                            
idx++;
                        }
                        new 
offset idx;
                        new 
result[64];
                        while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
                        {
                            
result[idx offset] = cmdtext[idx];
                            
idx++;
                        }
                        
result[idx offset] = EOS;
                        if(!
strlen(result))
                        {
                            
SendClientMessageplayeridCOLOR_GRAD2" DEBUG: /hoiata <ID/NIMI> <Pohjus>");
                            return 
1;
                        }
                        
PlayerInfo[giveplayerid][pWarns] ++;
                        if(
PlayerInfo[giveplayerid][pWarns] >= 5)
                        {
                            
PlayerInfo[playerid][pLocked] = 2;
                            
SendClientMessage(playeridCOLOR_LIGHTRED"Sa said banni, sest sul taitusid 5 hoiatust.");
                            
Ban(giveplayerid);
                            return 
1;
                        }
                        
format(stringsizeof(string), "Admin %s hoiatas sind. Pohjus: %s. "sendernameresult);
                        
SendClientMessage(giveplayeridCOLOR_LIGHTREDstring);
                        
format(stringsizeof(string), "Sa hoiatasid %s'i. Pohjus: %s."giveplayerresult);
                        
SendClientMessage(playeridCOLOR_LIGHTREDstring);
                        return 
1;
                    }
            }
        }
        return 
1;
    }

This should work.
Reply
#5

But it doesnt. Just crashes. If I commented that command, it compiles.

pawn Код:
if (strcmp( cmd, "/warn", true ) == 0 ) {
   
        if( IsPlayerConnected( playerid ) ) {
       
            if( gPlayerLogged[ playerid ] == 0) {
                return SendClientMessage( playerid, COLOR_GREY, " VIGA: Sa ei ole sisse logitud. ");

            if( PlayerInfo[ playerid ][ pAdmin ] < 1 )
                return SendClientMessage( playerid, COLOR_GREY, " VIGA: Ainult adminid vхivad seda kдsklust kasutada. ");
               
            tmp = strtok(cmdtext, idx);
            if( !strlen( tmp ) ) {
           
                SendClientMessage( playerid, COLOR_GRAD2, " DEBUG: /hoiata <ID/NIMI> <Pхhjus> ");
                return true ;
            }
            giveplayerid = ReturnUser( tmp );
            if( IsPlayerConnected( giveplayerid ) ) {
           
                    if( giveplayerid != INVALID_PLAYER_ID ) {
                   
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if( !strlen( result ) ) {
                       
                            SendClientMessage( playerid, COLOR_GRAD2, " DEBUG: /hoiata <ID/NIMI> <Pхhjus>");
                            return true ;
                        }
                        PlayerInfo[ giveplayerid ][ pWarns ] ++ ;
                        if( PlayerInfo[ giveplayerid ][ pWarns ] >= 3) {
                       
                                PlayerInfo[playerid][pLocked] = 2;
                            SendClientMessage( playerid, COLOR_LIGHTRED, " Sinu konto lukustati, kuna sul on tдpselt 3 vхi enam hoiatust. ");
                            Ban( giveplayerid );
                            return true ;
                        }
                        format( string, sizeof( string ), " Admin %s hoiatas sind. Pхhjus: %s. " , sendername , result );
                        SendClientMessage( giveplayerid, COLOR_LIGHTRED , string );
                        format( string, sizeof( string ), " Sa hoiatasid %s'i. Pхhjus: %s. " , giveplayer , result );
                        SendClientMessage( playerid ,COLOR_LIGHTRED , string );
                        return true ;
                    }
            }
        }
        return true ;
    }
This is the original script.
Edit: Nvm, the command works but if i warn somebody, it always warns me.
Reply
#6

bump.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)