Jump to content

Intrebare td


iPanter
 Share

Recommended Posts

Am facut asa: https://pastebin.com/LYczM3Sh

si primesc erorile astea:

Linia: if(CrateTime > 0) {

[debug] AMX backtrace:
[debug] #0 0035e4fc in public Timers () at C:\Users\Andrei\Desktop\burned.ro\gamemodes\wa-rpg.pwn:31352
[debug] Run time error 4: "Array index out of bounds"
[debug]  Accessing element at index 1995 past array upper bound 1000
Edited by iPanter
Link to comment
Share on other sites

  • Administrator
foreach( new x : Player )
{
    if( CrateTime[ x ] > 0 )
    {
        CrateTime[ x ] --;

        new amount, rand, string[ 256 ];

        if( CrateType[ x ] == 1 )
        {
            rand = random( 30 );
        }

        else
        {
            rand = random( 50 );
        }

        switch( rand )
        {
            case 0..15:
            {
                amount = random( 5 ) + 5;

                if( CrateType[ x ] == 1 ) { amount += 5; }

                format( string, sizeof string, "Step: %d/30~n~~y~%sx RP", 30 - CrateTime[ x ], FormatNumber( amount ) );
                PlayerTextDrawSetString( x, CrateTD[ 4 ], string );

                if( CrateTime[ x ] == 0 )
                {
                    PlayerInfo[ x ][ pExp ] += amount;
                    Update( x, pRP );

                    SCM( x, COLOR_LGREEN, "Felicitari! Ai castigat RP-uri!" );

                    SetTimerEx( "hideCrateTextdraws", 2000, true, "d", x );
                }
            }

            case 16..25:
            {
                amount = random( 50 ) + 100;

                if( CrateType[ x ] == 1 ) { amount += 100; }

                format(string, sizeof string, "Step: %d/30~n~~p~%s PremiumPoints", 30 - CrateTime[ x ], FormatNumber( amount ) );
                PlayerTextDrawSetString( x, CrateTD[ 4 ], string );

                if( CrateTime[ x ] == 0 ) 
                {
                    PlayerInfo[ x ][ pPremiumPoints ] += amount; 
                    Update( x, pPremiumPoints );

                    SCM( x, COLOR_LGREEN, "Felicitari! Ai castigat PremiumPoints!" ); 

                    SetTimerEx( "hideCrateTextdraws", 2000, true, "d", x );
                }            
            }

            default: 
            {
                amount = random( 1000000 ) + 500000;

                if( CrateType[ x ] == 1 ) { amount += 500000; }    

                format(string, sizeof string, "Step: %d/30~n~~g~$%s", 30 - CrateTime[ x ], FormatNumber( amount ) );
                PlayerTextDrawSetString( x, CrateTD[ 4 ], string );

                if( CrateTime[ x ] == 0 ) 
                {
                    GivePlayerCash(x, amount);
                    Update( x, pCashx );

                    SCM( x, COLOR_LGREEN, "Felicitari! Ai castigat bani!" );
                }
            }
        }
    }
}

function hideCrateTextdraws( playerid )
{

    for( new i = 0; i < 5; i++)
    {
        PlayerTextDrawHide( playerid, CrateTD[ i ] );
    }

    return true;
}

Ti-am facut eu partea de td si ti-am pus un timer care sa stearga singur textdraw-urile.

 

:wink:

Link to comment
Share on other sites

@LeonardAdv https://imgur.com/a/0MDehKs

 

 

C:\Users\Andrei\Desktop\burned.ro\gamemodes\wa-rpg.pwn(31164) : warning 219: local variable "x" shadows a variable at a preceding level
C:\Users\Andrei\Desktop\burned.ro\gamemodes\wa-rpg.pwn(31164) : error 017: undefined symbol "Player"
C:\Users\Andrei\Desktop\burned.ro\gamemodes\wa-rpg.pwn(31164) : error 017: undefined symbol "Player"
C:\Users\Andrei\Desktop\burned.ro\gamemodes\wa-rpg.pwn(31164) : warning 215: expression has no effect
C:\Users\Andrei\Desktop\burned.ro\gamemodes\wa-rpg.pwn(31164) : error 001: expected token: ";", but found "]"
C:\Users\Andrei\Desktop\burned.ro\gamemodes\wa-rpg.pwn(31164) : fatal error 107: too many error messages on one line
Edited by iPanter
Link to comment
Share on other sites

@  foreach( new x : Player )

 

Si aici e aia cu argument type mismach.

PlayerTextDrawSetString(playerid, CrateTD, "Loading...");
PlayerTextDrawShow(playerid, CrateTD);
Edited by iPanter
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...