Jump to content

[TUTORIAL] Cele mai intalnite erori/avertizmente in pawno!


DarkyTheAngel

Recommended Posts


[glow=black,2,300]ERORI:[/glow]


1.Expression has no effect:

Aceasta eroare este cauzata de simboluri (litere/cifre) puse aiurea in script.Ex.:

public OnPlayerConnect ( playerid )

{

    #defined SCM  SendClientMessage

    SCM ( playerid , 0xFFFFFFFF , "Darky" ) ; dsa

    return ( 1 ) ;

}

Ca sa rezolvati aceasta eroare trebuie sa stergeti acele simboluri:

public OnPlayerConnect ( playerid )

{

    #defined SCM  SendClientMessage

    SCM ( playerid , 0xFFFFFFFF , "Darky" ) ;

    return ( 1 ) ;

}

2.Symbol already defined 'X':

Aceasta eroare este cauzata de un simbol care este definit de mai multe ori.Ex.:

public OnPlayerConnect ( playerid )

{

    #defined SCM  SendClientMessage

    new

          name  [ MAX_PLAYER_NAME ] ,

          string [ 128            ] ,

          string [ 128            ] ;

    GetPlayerName ( playerid , name , sizeof ( name ) ) ;

    format ( string , sizeof ( string ) , "%s a intrat pe server." , name ) ;

    SCMToAll ( 0xFFFFFFFF , string ) ;

    return ( 1 ) ;

}

Ca sa rezolvati aceasta eroare trebuie sa stergeti unul dintre simbolurile definite de 2 ori sau sa il redenumiti pe unul dintre ele:

public OnPlayerConnect ( playerid )

{

    #defined SCM  SendClientMessage

    new

          name  [ MAX_PLAYER_NAME ] ,

          string [ 128            ] ;

    GetPlayerName ( playerid , name , sizeof ( name ) ) ;

    format ( string , sizeof ( string ) , "%s a intrat pe server." , name ) ;

    SCMToAll ( 0xFFFFFFFF , string ) ;

    return ( 1 ) ;

}

3.Cannot read from file 'X':

Aceasta eroare este cauzata de un include pus la inceputul scriptului (#include < dark >), dar el nu exista in pawno/includes.

Ca sa rezolvati aceasta eroare trebuie sa adaugati acel include in pawno/includes.

4.Empty statement:

Aceasta eroare este cauzata de un simbol care se repeta pe un rand.Ex.:

public OnPlayerEnterVehicle ( playerid , vehicleid , ispassenger )

{

    #defined SCM  SendClientMessage

    if ( vehicleid == 611 )

   

    {

        SCM ( playerid , 0xFFFFFFFF , "Darky"" ) ; // " se repeta.

     

        return ( 1 ) ;

    }

    return ( 1 ) ;

}

Ca sa scapati de aceasta eroare trebuie sa stergeti acel simbol:

public OnPlayerEnterVehicle ( playerid , vehicleid , ispassenger )

{

    #defined SCM  SendClientMessage

    if ( vehicleid == 611 )

   

    {

        SCM ( playerid , 0xFFFFFFFF , "Darky" ) ; // " nu se repeta.

     

        return ( 1 ) ;

    }

    return ( 1 ) ;

}

5.Undefined symbol 'X':

Aceasta eroare este cauzata de faptul ca folosesti un simbol care nu este creat.Ex.:

public OnPlayerConnect ( playerid )

{

    #defined SCM  SendClientMessage

    new

          string [ 128            ] ;

    GetPlayerName ( playerid , name , sizeof ( name ) ) ;

    format ( string , sizeof ( string ) , "%s a intrat pe server." , name ) ; // Name nu este creat.

    SCMToAll ( 0xFFFFFFFF , string ) ;

    return ( 1 ) ;

}

Ca sa scapati de aceasta eroare trebuie sa creeati acel simbol:

public OnPlayerConnect ( playerid )

{

    #defined SCM  SendClientMessage

    new

          name  [ MAX_PLAYER_NAME ] ,

          string [ 128            ] ;

    GetPlayerName ( playerid , name , sizeof ( name ) ) ;

    format ( string , sizeof ( string ) , "%s a intrat pe server." , name ) ; // Name este creat.

    SCMToAll ( 0xFFFFFFFF , string ) ;

    return ( 1 ) ;

}

6.Undefined symbol 'params':

Aceasta eroare se formeaza cand parametrii nu sunt suportati.Ex.:

if ( listitem == 0 ) return dcmd_text ( playerid , params ) ;

Ca sa scapati de aceasta eroare, folositi una din solutile de mai jos:

  • Opritiva din utilizarea parametrilor.Ex.:

if ( listitem == 0 ) return dcmd_text ( playerid ) ;

  • Adaugati urmatoarea linie in functie:

#pragma unused params

  • In cazul in care parametrii sunt folositi la un dialog, schimbati "params" in "inputtext":

if ( listitem == 0 ) return dcmd_text ( playerid , inputtext ) ;

7.Undefined symbol 'strtok':

Aceasta eroare apare cand "strtok" nu este definit.Ca sa rezolvati aceasta eroare adaugati urmatorul cod la sfarsitul scriptului:

strtok ( const string [ ] , &index )

{

    new

      length = strlen ( string ) ;

   

    while ( ( index < length ) && ( string [ index ] <= ' ' ) )

{

index++ ;

}

    new

      offset = index ;

   

    new

      result [ 20 ] ;

   

    while ( ( index < length ) && ( string [ index ] > ' ' ) && ( ( index - offset ) < ( sizeof ( result ) - 1 ) ) )

   

    {

   

        result [ index - offset ] = string [ index ] ;

       

        index++ ;

    }

        result [ index - offset ] = EOS ;

    return result ;

}

8.Function "PlayerToPoint" is not implemented:

Aceasta eroare iti spune ca functia "PlayerToPoint" nu este implementata.Ca sa rezolvi aceasta eroare, trebuie sa implementezi functia:

forward PlayerToPoint ( Float:radi , playerid , Float:x , Float:y , Float:z )

public PlayerToPoint ( Float:radi , playerid , Float:x , Float:y , Float:z )

{

new

Float:oldposx  , Float:oldposy  , Float:oldposz  ,

Float:tempposx , Float:tempposy , Float:tempposz ;

GetPlayerPos ( playerid , oldposx , oldposy , oldposz ) ;

tempposx = ( oldposx -x ) ;

tempposy = ( oldposy -y ) ;

tempposz = ( oldposz -z ) ;

if ( ( ( tempposx < radi ) && ( tempposx > -radi ) ) && ( ( tempposy < radi ) && ( tempposy > -radi ) ) && ( ( tempposz < radi ) && ( tempposz > -radi ) ) )

{

return ( 1 ) ;

}

return ( 0 ) ;

}

9.Function "IsPlayerInArea" is not implemented:

Aceasta eroare iti spune ca functia "IsPlayerInArea" nu este implementata.Ca sa rezolvi aceasta eroare, trebuie sa implementezi functia:

forward IsPlayerInArea ( playerid , Float:max_x , Float:min_x , Float:max_y , Float:min_y )

public IsPlayerInArea ( playerid , Float:max_x , Float:min_x , Float:max_y , Float:min_y )

{

    new

Float:pX ,

Float:pY ,

Float:pZ ;

    GetPlayerPos ( playerid , pX , pY , pZ ) ;

   

    if ( pX <= max_x && pX >= min_x && pY <= max_y && pY >= min_y ) return ( 1 ) ;

   

    return ( 0 ) ;

}

10.Function "ProxDetector" is not implemented:

Aceasta eroare iti spune ca functia "ProxDetector" nu este implementata.Ca sa rezolvi aceasta eroare, trebuie sa implementezi functia:

forward ProxDetector ( playerid , Float:position , string [ ] , color )

public ProxDetector ( playerid , Float:position , string [ ] , color )

{

    new

Float:X ,

Float:Y ,

Float:Z ;

    GetPlayerPos ( playerid , X , Y , Z ) ;

   

    foreach ( Player, i )

    {

        if ( IsPlayerInRangeOfPoint ( i , position , X , Y , Z ) )

        {

            SCM ( i , color , string ) ;

           

        }

    }

}

11.Function "CrimInRange" is not implemented:

Aceasta eroare iti spune ca functia "CrimInRange" nu este implementata.Ca sa rezolvi aceasta eroare, trebuie sa implementezi functia:

forward CrimInRange ( Float:radi , playerid , copid ) ;

public CrimInRange ( Float:radi , playerid , copid )

{

if ( IsPlayerConnected ( playerid ) && IsPlayerConnected ( copid ) )

{

new

Float:posx    , Float:posy    , Float:posz    ,

Float:oldposx  , Float:oldposy  , Float:oldposz ,

Float:tempposx , Float:tempposy ;

GetPlayerPos ( playerid , oldposx , oldposy , oldposz ) ;

GetPlayerPos ( copid , posx , posy , posz ) ;

tempposx = ( oldposx -posx ) ;

tempposy = ( oldposy -posy ) ;

if ( ( ( tempposx < radi ) && ( tempposx > -radi ) ) && ( ( tempposy < radi ) && ( tempposy > -radi ) ) )

{

return ( 1 ) ;

}

}

return ( 0 ) ;

}

12.Unknown parameter in substitution:

Aceasta eroare apare cand ati folosit un parametru care nu este definit.Ex.:

#define SPP(%1,%2,%3,%4); SetPlayerPos(%5,%2,%3,%4); // %5 nu este definit. // by iggy1.

Ca sa rezolvati aceasta eroare, trebuie sa folositi parametrii exacti.

#define SPP(%1,%2,%3,%4); SetPlayerPos(%1,%2,%3,%4); // by iggy1.

13.Argument type mismatch (argument 2):

Aceasta eroare apare cand continutul nu este pus corespunzator.Ex.:

SCM ( playerid , "Darky" , 0xFFFFFFFF ) ;

Ca sa rezolvati aceasta eroare, trebuie sa aranjati continutul liniei:

SCM ( playerid , 0xFFFFFFFF , "Darky" ) ;

14.Only a single statement (or expression) can follow each “case”:

Aceasta eroare se formeaza cand un "string", nu este pozitionat corect.Ex.:

main ( )

{

    switch ( x )

{

        case 0: print ( "Darky" ) ; print ( "Darky" ) ;

       

    }

   

    return ( 1 ) ;

}

Ca sa rezolvati aceasta eroare, trebuie sa aranjati codul:

main ( )

{

    switch ( x )

    {

        case 0:

       

        {

            print ( "Darky" ) ;

            print ( "Darky" ) ;

        }

   

    }

   

    return ( 1 ) ;

}

15.Array sizes do not match, or destination array is too small:

Aceasta eroare apare cand aria este prea mica.Ex.:

new test [ 8 ] ; // 8 este aria.

new msg [ ] = "Darky" ;

test = msg ;

Ca sa rezolvati aceasta eroare, trebuie sa mariti aria:

new test [ 15 ] ; // 15 este aria.

new msg [ ] = "Darky" ;

test = msg ;


[glow=black,2,300]AVERTIZMENTE:[/glow]


1.Tag mismatch:

Acest avertizment apare cand ati asigurat o eticheta gresita ariei.Ex.:

new Logo0 ;

Ca sa il rezolvati, trebuie sa rescrieti aria corect:

new Text:Logo0 ;

2.Loose indentation:

Acest avertizment apare cand o linie nu este pozitionata bine.Ex:

public OnGameModeInit ( )

{

print ( "Darky" ) ;

    return ( 1 ) ;

}

Ca sa il rezolvati, trebuie sa pozitionati linia corect:

public OnGameModeInit ( )

{

    print ( "Darky" ) ;

    return ( 1 ) ;

}

3.Nested comment:

Acest avertizment apare cand ati deschis un comentariu, in alt comentariu.Ex.:

public OnGameModeInit ( )

{

    /* /* print ( "Darky" ) ; */

   

    return ( 1 ) ;

}

Ca sa il rezolvati, stergeti al doilea comentariu:

public OnGameModeInit ( )

{

    /* print ( "Darky" ) ; */

   

    return ( 1 ) ;

}

4.Symbol is never used X':

Acest avertizment se formeaza cand ati creat o arie noua, dar nu ati folosit-o.Ex.:

new string [ 128 ] ;

Ca sa il rezolvati, stergeti acea arie sau folositi-o.

5.Unreachable code:

Acest avertizment se formeaza cand codul nu este accesibil, mai exact, cand codul este reintors de mai multe ori.Ex:

public OnPlayerText ( playerid , text [ ] )

{

#define SCM  SendClientMessage

new

    bool:AFK [ MAX_PLAYERS ] ;

if ( AFK [ playerid ] == 1 )

{

SCM ( playerid , -1 , "Darky" ) ;

return ( 0 ) ;

}

return ( 1 ) ;

else return ( 0 ) ;

}

Ca sa rezolvati acest avertizment, asigurati-va ca, codul este accesibil:

public OnPlayerText ( playerid , text [ ] )

{

#define SCM  SendClientMessage

new

    bool:AFK [ MAX_PLAYERS ] ;

if ( AFK [ playerid ] == 1 )

{

SCM ( playerid , -1 , "Darky" ) ;

return ( 0 ) ;

}

return ( 1 ) ;

}

6.Number of arguments does not match definition:

Acest avertizment apare cand ai mai multe sau mai putine argumente decat ar trebui sa ai.Ex.:

CMD:test( playerid , params [ ] )

{

SetPlayerPos ( playerid , X , Y , Z , 0 ) ; // Am pus 0 la final, 0 fiind "interior".

return ( 1 ) ;

}

Ca sa il rezolvati, trebuie sa folositi sintaxa corecta."SetPlayerPos" are 4 argumente acestea fiind "playerid,X,Y,Z" asa ca "interior (0)" nu este pus corect acolo:

CMD:test( playerid , params [ ] )

{

SetPlayerPos ( playerid , X , Y , Z ) ;

  SetPlayerInterior ( playerid , 0 ) ;

return ( 1 ) ;

}

7.Old style prototypes used with optional semicolon:

Acest avertizment apare cand lipsesc semi-coloane.

Ca sa il rezolvati, adaugati la inceputul scriptului urmatoarea linie:

#pragma semicolon 0

P.S: Rock, imi cer scuze, din nou 21.gif, pentru ca ti-am folosit stilul de postare.

Link to comment
Share on other sites

Hehe, abia acum m-am gandit sa fac o verificare si prin sectiunea asta :))

Deci la topicul asta o sa ii fac multa "reclama" aici pe forum. Cum vad pe unu ca intreaba cum rezolva nush ce eroare, si e explicat aici, le pun link-ul in fata :))

Felicitari!

logo.png

ATENTIE!!! Nu imi trimiteti mesaje private care au legatura cu scriptingul. NU mai scriptez.

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.