Jump to content

Recommended Posts

Posted

In primul rand faci o functie ca sa afli cati playeri sunt online.
 

stock ConnectedPlayers()
{
    new Connected;
    foreach(new i: Player)
        Connected++;

    return Connected;
}

Apoi faci niste variabile, de exemplu BonusON(eventul e on) si BonusMoney(premiul), BonusJucatori(la cati playeri sa se dea premiul).

new BonusON, BonusJucatori, BonusMoney;

Apoi faci tu un timer sau pui intr-un timer existent sa verifice daca eventul e on si daca nr de playeri e egal cu cel pus de tine la event.

function CheckPlayers()
{
    if( BonusON == 1 )
    {
        if ( BonusJucatori == ConnectedPlayers() )
        {
            foreach(new i: Player)
            {
            	BonusON = 0;
            	GivePlayerCash(i, BonusMoney);
            }
        }
    }
	return 1;
}

Apoi comanda ca sa setezi eventul on:
 

CMD:setevent( playerid, params[ ] )
{
    if ( sscanf( params, "dd", params[ 0 ], params[ 1 ] ) || params[ 0 ] <= Iter_Count(Player) || params[ 1 ] < 1 )
        return SendClientMessage(playerid, 0xFFFF00AA, "/setevent <Online Players> <Money>" ); //params[ 0 ] <= Iter_Count(Player) verifica daca nr ce il pui in comanda e mai mic decat nr de jucatori conectati. Daca nu folosesti iteratori(Ysi) foloseste functia PlayersConnected() de mai sus.

    BonusON = 1;
    BonusJucatori = params[ 0 ];
    BonusMoney = params[ 1 ] ;

    new string[128];
    format(string, sizeof(string), "Evenimentul jucatori conectati a fost pornit. Cand serverul va atinge %d jucatori conectati toti vor 		primi %d$.", BonusJucatori, BonusMoney);
    SendClientMessageToAll(0xFF0000AA, string);
    return 1;
}

Sper ca te-am ajutat si ca ai inteles!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.