SA-MP Forums Archive
Money Rain Help! - 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: Money Rain Help! (/showthread.php?tid=615471)



Money Rain Help! - danish007 - 22.08.2016

How can i do that, if i use /moneyrain (amount) the amount will be divided in all players equally?


Re: Money Rain Help! - WhiteGhost - 22.08.2016

Wrong,delete.


Re: Money Rain Help! - Shinja - 22.08.2016

PHP код:
CMD:moneyrain(playeridparams[])
{
    new 
moneyplayers;
    if(
sscanf(params"i"money)) return SendClientMessage(playerid, -1"USAGE: moneyrain amount");
    for(new 
ij=GetPlayerPoolSize(); i<=ji++){if(IsPlayerConnected(i)) players++;} //Getting EXACT number of players online
    
new pmoney moneypmoney /= players;
    for(new 
ij=GetPlayerPoolSize(); i<=ji++)
    {
        if(
IsPlayerConnected(i)) GivePlayerMoney(ipmoney);
    }
    return 
1;




Re: Money Rain Help! - Stinged - 22.08.2016

PHP код:
new icountpool_size GetPlayerPoolSize();
for (
0<= pool_sizei++)
{
    if (
IsPlayerConnected(i))
        
count++;
}
amount /= count;
for (
0<= pool_sizei++)
{
    
// No need to use IsPlayerConnected ONLY IF you're only using natives
    // Because they do not get called if the player isn't online
    
GivePlayerMoney(iamount);

It would be more efficient if you use foreach/y_iterate instead.
You replace that with this:
PHP код:
amount /= Iter_Count(Player);
foreach (new 
Player)
{
    
GivePlayerMoney(iamount);




Re: Money Rain Help! - danish007 - 23.08.2016

Thanks Stinged, +Rep