23.04.2011, 17:26
Hello all
I've got 2 issues,I will be glad if someone could help me solve them:
1.I made a lottery script,it was all got,but I changed 1 public of it in a bit:
I get no errors and no warnings,but if there is more than 1 winner,it posts only the first winner of the lotto.
Could anyone help me spotting the issue?
2.My friend sent me this stock:
But he forgot to give me the rgba2hex stock/include (whatever it is) either and he also claims he can not find it now /=
Does anyone have it's include or an alternative function?
Thanks for all the helpers
Happy Easter!
I've got 2 issues,I will be glad if someone could help me solve them:
1.I made a lottery script,it was all got,but I changed 1 public of it in a bit:
PHP Code:
public Lotto()
{
new WinnersName[24];
SendClientMessageToAll( COLOR_ALINES,"----------[Lotto System]----------");
SendClientMessageToAll( COLOR_LOTTO,"The lotto was finished!");
LottoNumber = random(49) + 1;
format(String, sizeof(String), "The winning number is: %d",LottoNumber);
SendClientMessageToAll( COLOR_LOTTO,String);
new WinnersCount;
for(new i = 0; i < GetMaxPlayers(); i++) {
if(IsPlayerConnected(i) && LottoNum[i] == LottoNumber) {
WinnersCount++;
GetPlayerName(i,WinnersName,24);
if(WinnersCount = 1) {
format(String, sizeof(String), "%s(ID:%d) Won the lotto and got %d$!",WinnersCount,LottoPlayers*1500/WinnersCount);
SendClientMessageToAll( COLOR_LOTTO,String); }
if(WinnersCount > 1) {
format(String, sizeof(String), "%d Players won the lotto,they are:",WinnersCount);
SendClientMessageToAll( COLOR_LOTTO,String);
format(String, sizeof(String), ">>%s(ID:%d)",WinnersName,i);
SendClientMessageToAll( COLOR_LOTTO,String);
format(String, sizeof(String), "Each winner will get %d$!",LottoPlayers*1500/WinnersCount);
SendClientMessageToAll( COLOR_LOTTO,String); }}}
if(!WinnersCount) SendClientMessageToAll( COLOR_LOTTO,"Nobody won the lotto!");
SendClientMessageToAll( COLOR_ALINES,"----------------------------------");
LottoWinners();
LottoOn = 0;
}
Could anyone help me spotting the issue?
2.My friend sent me this stock:
PHP Code:
stock SetPlayerRandomColor(playerid)
{
new r = random(256),g = random(256),b = random(256);
while(r > 200 && g > 200 && b > 200)
{
r = random(256),g = random(256),b = random(256);
}
return SetPlayerColor(playerid,rgba2hex(r,g,b,100));
}
Does anyone have it's include or an alternative function?
Thanks for all the helpers
Happy Easter!