SA-MP Forums Archive
question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: question (/showthread.php?tid=249344)



question - iJumbo - 18.04.2011

can i make every 100 score my player Variable increase of 1?

in a simple code? with a timer


Re: question - Raimis_R - 18.04.2011

Yes u can


Re: question - Cjgogo - 18.04.2011

I don't understand exactly what you're saying,you mean if a person ahs 100 score ,than u want it to increase to 101 and then to 102 at a time(defined by you)?


Re: question - Raimis_R - 18.04.2011

Okey maybe i understend

pawn Код:
SetTimerEx( "LevelUp",1000,true,"i",playerid );

forward LevelUp( playerid );
public LevelUp( playerid )
{
    GetPlayerScore( playerid,SetPlayerScore( playerid )+1 );
    if( GetPlayerScore( playerid ) >= 100 )
    {
        //Your Variable
    }
    return true;
}



Re: question - Lorenc_ - 18.04.2011

Quote:
Originally Posted by Raimis_R
Посмотреть сообщение
Okey maybe i understend

pawn Код:
SetTimerEx( "LevelUp",1000,true,"i",playerid );

forward LevelUp( playerid );
public LevelUp( playerid )
{
    GetPlayerScore( playerid,SetPlayerScore( playerid )+1 );
    if( GetPlayerScore( playerid ) >= 100 )
    {
        //Your Variable
    }
    return true;
}
Lets say we add a single timer that loops completely through all players,
having a timer run on every single player is crazy :O


Re: question - Raimis_R - 18.04.2011

Mm okey.

pawn Код:
SetTimer( "LevelUp",1000,true );

forward LevelUp(  );
public LevelUp(  )
{
    for( new playerid = 0; playerid != MAX_PLAYERS; playerid++ )
    {
        if( !IsPlayerConnected( playerid )) continue;
       
        GetPlayerScore( playerid,SetPlayerScore( playerid )+1 );
        if( GetPlayerScore( playerid ) >= 100 )
        {
            //Your Variable
        }
    }
    return true;
}



Re: question - iJumbo - 18.04.2011

not score + of 100 every 100 score .. example i have 0 score......now 89....now 100 LVL up!
now 130.....160...200 LEVEL UP .... and to infinite ..