Lotto -
STONEGOLD - 09.06.2015
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 i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
tplayers++;
}
}
new st[128];
format(st, 128, "There are currently %d players connected.",tplayers);
SendClientMessageToAll(COLOR_INDIGO, st);
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_INDIGO, st);
new d = randomnumber(LOTTO_MIN_RAND,LOTTO_MAX_RAND);
new newamount = LOTTO_AMOUNT +d;
LOTTO_AMOUNT = newamount;
}
else
{
new name[24],
st[128];
GetPlayerName(rand, name, 24);
GivePlayerMoney(rand, LOTTO_AMOUNT);
SendClientMessage(rand, COLOR_INDIGO, "You have won the lotto!");
format(st,128,"%s (%d) has won the lotto! Congratulations to him! Lotto amount: $%d. Go rob him!",name, rand, LOTTO_AMOUNT);
SendClientMessageToAll(COLOR_INDIGO,st);
format(st,128,"You have won ~g~$ %d~n~~r~Congrats!",LOTTO_AMOUNT);
GameTextForPlayer(rand, st, 6000, 5);
LOTTO_AMOUNT=50000;
}
return 1;
}
stock randomnumber(min, max) // ******
{
new rand = random(max-min)+min;
return rand;
}
public OnPlayerConnect(playerid)
{
tplayers++;
return 1;
}
public OnPlayerDisconnect(playerid)
{
tplayers--;
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
Re: Lotto -
AlexBlack - 09.06.2015
i think it's from this : SetTimer("Lotto",LOTTO_TIME_IN_MINUTES/6000,1);
i don't understand what you want to do , because you are doing now a timer = 10/6000 , it will done 0.SOMETHING and the timer will be repeat too fast
Re: Lotto -
STONEGOLD - 09.06.2015
This is my GameClock. How to set on clock 18?
PHP код:
forward GameModeClock(); ///clock start
public GameModeClock()
{
new string[256],string2[128];
if (GameMinute == 0)
{
format(string, sizeof(string), "%s",string);
//printf(string);
format(string2, sizeof(string2), "worldtime %s",string);
SendRconCommand(string2);
format(string, sizeof(string), "{FFFFFF}Game Time: {BDBDBD}%s",string);
SendClientMessageToAll(ROJO, string);
}
}
Re: Lotto -
AlexBlack - 10.06.2015
Why you want to set it to 18 ? it will change nothing to the LOTTO system.
to set the clock to 18 do this
PHP код:
SendRconCommand("worldtime 18");
adapt this to a command or something like that i will not give you everything.
Re: Lotto -
STONEGOLD - 10.06.2015
I don't want to set Time. I want to set Lotto release on Clock 18
PHP код:
forward GameModeClock(); ///clock start
public GameModeClock()
{
new string[256],string2[128];
if (GameMinute == 18)
{
SetTimer("lotto" 300)
}
}
something like thi ^^
Re: Lotto -
AlexBlack - 10.06.2015
you need to know the basics of the pawn ...
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()
{
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_INDIGO, st);
new d = randomnumber(LOTTO_MIN_RAND,LOTTO_MAX_RAND);
new newamount = LOTTO_AMOUNT +d;
LOTTO_AMOUNT = newamount;
}
else
{
new name[24],
st[128];
GetPlayerName(rand, name, 24);
GivePlayerMoney(rand, LOTTO_AMOUNT);
SendClientMessage(rand, COLOR_INDIGO, "You have won the lotto!");
format(st,128,"%s (%d) has won the lotto! Congratulations to him! Lotto amount: $%d. Go rob him!",name, rand, LOTTO_AMOUNT);
SendClientMessageToAll(COLOR_INDIGO,st);
format(st,128,"You have won ~g~$ %d~n~~r~Congrats!",LOTTO_AMOUNT);
GameTextForPlayer(rand, st, 6000, 5);
LOTTO_AMOUNT=50000;
}
return 1;
}
stock randomnumber(min, max) // ******
{
new rand = random(max-min)+min;
return rand;
}
public OnPlayerConnect(playerid)
{
tplayers++;
return 1;
}
public OnPlayerDisconnect(playerid)
{
tplayers--;
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
PHP код:
forward LunchLotto()
public LunchLotto()
{
SetTimer("Lotto", 1000,false);
LOTTO_AMOUNT = randomnumber(100000,200000);
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
tplayers++;
}
}
new st[128];
format(st, 128, "There are currently %d players connected.",tplayers);
SendClientMessageToAll(COLOR_INDIGO, st);
return 1;
}
Now you need to script a condition when the time is 18 you execute this function : LunchLotto();