does not exists

Started by Cool, Nov 05, 2015, 04:06 PM

Previous topic - Next topic

rulk

you haven't created the stats array then, its trying to find index zero of the array, which does'nt exists
stats <- array( 100, null );
We are all god's children.

Cool


rulk

where did you create the array in OnScriptLoad ?
We are all god's children.

Cool


rulk

#19
if i recreate the error by using
function onScriptLoad( )
{
     stats <- array( 100, null );

     stats[ 0 ] = pstats( 10, 10 );

     if ( stats[ 0 ].kills > 0 ) print("yes");
}



class pstats
{
     constructor( ... )
     {
          kills = vargv[0];
          deaths = vargv[1];
     }

     kills = null;
     deaths = null;
}
We are all god's children.

rulk

i can't think what else could be the problem chap, see if anyone else can
We are all god's children.

Cool

same error and printed on console yes

Cool

not working already i try

KAKAN

Okay mate.
Now lets goto debugging mode.
Add this before the error line and tell the results.
print( kills );Tell us what's the output
oh no

Cool

same line but error is kills does not exists

Cool

Thanks i solved it Thanks for reply if any came i will unlock topic :D

Cool

#26
@KAKAN  cash is inserting in db but not showing in hand whats reason

KAKAN

Use player.Cash for inserting to the player's cash which is shown in the player's screen, else use this function if u FAS
function IncCash( player, amount ){
player.Cash += amount.tointeger()
if( stats[ player.ID ].Logged ) stats[ player.ID ].Cash += amount.tointeger()
}
For decrasing cash use this:-
function DecCash( player, amount ){
player.Cash -= amount.tointeger()
if( stats[ player.ID ].Logged ) stats[ player.ID ].Cash -= amount.tointeger()
}
oh no

Cool

Logged does not exists

KAKAN

What do you use then?
Have a look on your script.
else use this:-
function IncCash( player, amount ){
player.Cash += amount.tointeger()
stats[ player.ID ].Cash += amount.tointeger()
}
//And this:-
function DecCash( player, amount ){
player.Cash -= amount.tointeger()
stats[ player.ID ].Cash -= amount.tointeger()
}
oh no