Help Here cash got bugged or something - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help Here cash got bugged or something (
/showthread.php?tid=508708)
Help Here cash got bugged or something -
AroseKhanNiazi - 23.04.2014
Код:
if(GameHour == 23 && GameMinute == 59)
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if(IsPlayerConnected(playerid) && spawned[playerid] == 1)
{
pInfo[playerid][pDaysAlive] ++;
if(pInfo[playerid][pDaysAlive] == 365)
{
pInfo[playerid][pBirthdays] ++;
new pmoney, randcash;
pmoney = GetPlayerMoney(i);
randcash = random(pmoney);
GiveCashToPlayer(playerid,-randcash);
GivePlayerMoney(playerid, randcash);
SCM(playerid,COLOR_RED,"Happy Birth Day (TESTING)");
}
}
}
}
}
now when there it the birthday of someone and no one is online it will keep giving him the unlimited money
but i want to give him the money an random amount we get from all others from their total money
Код:
forward GiveCashToPlayer(playerid,const money);
public GiveCashToPlayer(playerid,const money)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(!IsPlayerConnected(i)) continue;
if(playerid == i) continue;
GivePlayerMoney(i,money);
}
}