SA-MP Forums Archive
I need an idea and example for an training system [ REP + ] - 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)
+--- Thread: I need an idea and example for an training system [ REP + ] (/showthread.php?tid=570866)



I need an idea and example for an training system [ REP + ] - _GHT_MarK445 - 14.04.2015

Hey guys,

i am working on my gamemode but how can i do this:

Player will write /training and it will set him animation for 1 minute, also an timer. After the 1 minute animation stops and the player receives +1 point to his training skills. Thanks guys!


Re: I need an idea and example for an training system [ REP + ] - Smileys - 14.04.2015

pawn Код:
new
    gPoints[ MAX_PLAYERS char ], // too keep track of the points
    gTraining[ MAX_PLAYERS char ] // set to true if the player is training
;

CMD:training( playerid, params[ ] )
{
    if( gTraining{ playerid } ) // if the player is already training
        return SendClientMessage( playerid, -1, "You're already training!" );

    gTraining{ playerid } = true; // setting it to true so the player is training
    // ApplyAnimation( your_animation_data ); // change this to your animation stuff
    SetTimerEx( "OnPlayerFinishTraining", 60000, false, "i", playerid ); // setting the timer
    return 1;
}

forward OnPlayerFinishTraining( playerid );
public OnPlayerFinishTraining( playerid )
{
    gPoints{ playerid }++; // increasing the points
    gTraining{ playerid } = false; // setting it back to false so the player can train again
    ClearAnimations( playerid ); // clear the animations
    SendClientMessage( playerid, -1, "You've finished you training and gained 1 point!" ); // sending le message
    return 1;
}



Re: I need an idea and example for an training system [ REP + ] - _GHT_MarK445 - 14.04.2015

Thank you brother, but there is an problem. I setted the animation also to 60000 but the animation ends like 3 seconds before the actual training. So the animation stops like 3 seconds before it ends so.. it is just loosing that profesionallity. If you know what i mean.

And there is one more problem.. when i use the command FOR THE FIRST time i join on server, the animation is just not playing.. i need to type the command 2 times to start the animation. Which is weird.

Thanks for help brother, anyways i REPPED you + but.. if someone help me with this, i will rep him also.


Re: I need an idea and example for an training system [ REP + ] - R0 - 14.04.2015

post the animation code that you used.