SA-MP Forums Archive
randomly - 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: randomly (/showthread.php?tid=511572)



randomly - Champ - 06.05.2014

how to go through all the players playing in the server and give randomly any one a prize.

do you know ?


Re : randomly - yusei - 06.05.2014

maybe this can help you
http://pastebin.com/5f0pjpWB
it's a old script : not mine


Re: randomly - Champ - 06.05.2014

umm no.. :/


Re: randomly - bustern - 06.05.2014

Example:
PHP код:
stock giftsystem(playerid)
{
        new 
rand random(6);
        switch(
rand)
        {
                case 
0:
                {
                
GiveDodMoney(playerid5000);
                 
SendClientMessage(playeridCOLOR_YELLOW,"*You gained random reward - $5000*");
                }
                case 
1:
                {
                
PlayerInfo[playerid][pMaterials] += 5000;
                 
SendClientMessage(playeridCOLOR_YELLOW,"*You gained random reward - 5000 Materials*");
                }
                case 
2:
                {
                
GiveDodWeapon(playerid2799999);
                 
SendClientMessage(playeridCOLOR_YELLOW,"*You gained random reward - SPAS*");
                }
                case 
3:
                {
                
GiveDodWeapon(playerid3199999);
                 
SendClientMessage(playeridCOLOR_YELLOW,"*You gained random reward - M4*");
                }
                case 
4:
                {
                
PlayerInfo[playerid][pcocaine] += 10;
                 
SendClientMessage(playeridCOLOR_YELLOW,"*You gained random reward - 10 grams of Cocaine*");
                }
                case 
5:
                {
                
PlayerInfo[playerid][pWeed] += 30;
                 
SendClientMessage(playeridCOLOR_YELLOW,"*You gained random reward - 30 grams of Weed*");
                }
        }




Re: randomly - Champ - 06.05.2014

I will try foreach.

Thanks.