Lotto
#1

What's wrong with this script. It makes me laggy and this as you can see in pic.


PHP код:
#define CHANCES 50
new LOTTO_AMOUNT;
#define LOTTO_TIME_IN_MINUTES 10// Ten minutes
#define LOTTO_MIN_RAND 20000
#define LOTTO_MAX_RAND 70000
#define COLOR_INDIGO 0x33CCFFAA
#include <a_samp>
new tplayers=0;
public 
OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" Blank Filterscript by your name here");
    print(
"--------------------------------------\n");
    
SetTimer("Lotto",LOTTO_TIME_IN_MINUTES/6000,1);
    
LOTTO_AMOUNT randomnumber(100000,200000);
    for(new 
ii<MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            
tplayers++;
        }
    }
    new 
st[128];
    
format(st128"There are currently %d players connected.",tplayers);
    
SendClientMessageToAll(COLOR_INDIGOst);
    return 
1;
}
forward Lotto();
public 
Lotto()
{
    new 
randoms[CHANCES];
    
#pragma unused randoms
    
new rand random(sizeof(randoms));
    if(!
IsPlayerConnected(rand))
    {
    
SendClientMessageToAll(COLOR_C"Alas! There was no winner for the lotto today.");
    new 
st[128];
    
format(st,128,"The current lotto: $%d. The random player this time was: %d. Better luck next time!",LOTTO_AMOUNT,rand);
    
SendClientMessageToAll(COLOR_INDIGOst);
    new 
randomnumber(LOTTO_MIN_RAND,LOTTO_MAX_RAND);
    new 
newamount LOTTO_AMOUNT +d;
    
LOTTO_AMOUNT newamount;
    }
    else
    {
    new 
name[24],
         
st[128];
    
GetPlayerName(randname24);
    
GivePlayerMoney(randLOTTO_AMOUNT);
    
SendClientMessage(randCOLOR_INDIGO"You have won the lotto!");
    
format(st,128,"%s (%d) has won the lotto! Congratulations to him! Lotto amount: $%d. Go rob him!",namerandLOTTO_AMOUNT);
    
SendClientMessageToAll(COLOR_INDIGO,st);
    
format(st,128,"You have won ~g~$ %d~n~~r~Congrats!",LOTTO_AMOUNT);
    
GameTextForPlayer(randst60005);
    
LOTTO_AMOUNT=50000;
    }
    return 
1;
}
stock randomnumber(minmax// ******
{
    new 
rand random(max-min)+min;
    return 
rand;
}
public 
OnPlayerConnect(playerid)
{
    
tplayers++;
    return 
1;
}
public 
OnPlayerDisconnect(playerid)
{
    
tplayers--;
    return 
1;
}
public 
OnFilterScriptExit()
{
    return 
1;

Reply


Messages In This Thread
Lotto - by STONEGOLD - 09.06.2015, 23:25
Re: Lotto - by AlexBlack - 09.06.2015, 23:44
Re: Lotto - by STONEGOLD - 09.06.2015, 23:59
Re: Lotto - by AlexBlack - 10.06.2015, 00:10
Re: Lotto - by STONEGOLD - 10.06.2015, 00:46
Re: Lotto - by AlexBlack - 10.06.2015, 02:09

Forum Jump:


Users browsing this thread: 1 Guest(s)