#1

Hello, i'm stuck with lotto.

I Already made that the people can buy lotto but i dont know how to make 'public lotto'(?) that rolling every 60minut and give random number, if people have it then he is winner.

Код:
COMMAND:ostaloto(playerid, params[])
{
	new string[128];
	new lotonumber;
	if(PlayerLoggedIn[playerid] == true)
	{
	    if(!sscanf(params, "i", lotonumber))
	    {
	        if(lotonumber < 1 || lotonumber > 99)
	        {
	        	if(KasutajaInfo[playerid][LotoOlemas] == 0)
				{
  	 				if(KasutajaInfo[playerid][Raha] < 150)
			    	{
	    	    		KasutajaInfo[playerid][LotoOlemas] = KasutajaInfo[playerid][LotoOlemas] + 1;
	    	    		KasutajaInfo[playerid][LotoNumber] = lotonumber;
	    	    		format(string, sizeof(string), "* Ostsid endale loto numbriga %d *", lotonumber);
	    	    		SCM(playerid, COLOR_WHITE, string);
					}
					else SCM(playerid, COLOR_RED, "Sul pole piisavalt raha, vajalik 150$");
				}
				else SCM(playerid, COLOR_RED, "Sul on juba pilet olemas!");
			}
			else SCM(playerid, COLOR_RED, "Pileti number peba olema suurem kui 1 ja vдiksem kui 99");
		}
		else SCM(playerid, COLOR_YELLOW, "KASUTA: /ostaloto [number]");
	}
	else SCM(playerid, COLOR_RED, "Sa pole sisse logitud!");
	return 1;
}
Reply
#2

Код:
//In OnGameModeInit
SetTimer("@Lotto",1000*60*60,1);

@Lotto();@Lotto()
{
    new lotto =  random(99)+1; //Lotto Numbers between 1-99
    for(new i,l=GetPlayerPoolSize()+1; i<l; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(KasutajaInfo[i][LotoNumber] == lotto)
        {   
             //Here the player has won!
        }
        //Here reset the player values
        KasutajaInfo[i][LotoNumber] = 0;
    }
}
Greekz
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)