Random Weapon with Rate Percentage
#2

do a random with number of 100
compare the returned value...
->
PHP код:
                            else if(level >= 101 && level <= 200// truck level 3
                            
{
                                switch(
random(100)) // random 9mm va sdpistol
                                
{
                                    case 
0..44// 9mm
                                    
{
                                        
SendClientMessageEx(playeridCOLOR_LIGHTBLUE"* Ban nhan duoc mien phi 9mm cho viec van chuyen vu khi trai phep.");
                                        
SendClientMessageEx(playeridCOLOR_YELLOW"* Khong duoc su dung vu khi duoc thuong cho muc dich xau nhu KOS/DM nonRP, neu vi pham se bi han che vu khi.");
                                        
GivePlayerValidWeapon(playerid2260000);
                                    }
                                    case 
45..89// sdpistol
                                    
{
                                        
SendClientMessageEx(playeridCOLOR_LIGHTBLUE"* Ban nhan duoc mien phi sdpistol cho viec van chuyen vu khi trai phep.");
                                        
SendClientMessageEx(playeridCOLOR_YELLOW"* Khong duoc su dung vu khi duoc thuong cho muc dich xau nhu KOS/DM nonRP, neu vi pham se bi han che vu khi.");
                                        
GivePlayerValidWeapon(playerid2360000);
                                    }
                                    case 
90..99// shotgun
                                    
{
                                        
SendClientMessageEx(playeridCOLOR_LIGHTBLUE"* Ban nhan duoc mien phi Shotgun cho viec van chuyen vu khi trai phep.");
                                        
SendClientMessageEx(playeridCOLOR_YELLOW"* Khong duoc su dung vu khi duoc thuong cho muc dich xau nhu KOS/DM nonRP, neu vi pham se bi han che vu khi.");
                                        
GivePlayerValidWeapon(playerid2560000);
                                    }
                                }
                            } 
Reply


Messages In This Thread
Random Weapon with Rate Percentage - by Dawkin - 24.07.2018, 10:03
Re: Random Weapon with Rate Percentage - by jlalt - 24.07.2018, 10:07
Re: Random Weapon with Rate Percentage - by coool - 24.07.2018, 10:11
Re: Random Weapon with Rate Percentage - by jlalt - 24.07.2018, 10:16
Re: Random Weapon with Rate Percentage - by Dawkin - 24.07.2018, 12:11
Re: Random Weapon with Rate Percentage - by NaS - 24.07.2018, 16:20

Forum Jump:


Users browsing this thread: 1 Guest(s)