Raised This Month: $231 Target: $400
 57% 

Solved get random one item


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tepegoz
Senior Member
Join Date: Apr 2019
Old 12-11-2020 , 11:47   get random one item
Reply With Quote #1

PHP Code:
for (new item_id 0item_id <= g_charcounter item_id++)
        {    
        
        if(
item_data[item_id][CHAR_TYPE] == TYPE_WEAPON || item_data[item_id][CHAR_TYPE] == TYPE_SHIELD){
        
        
client_printcolor(id"/yItem /g%s /yget this item!"item_name[item_id] );


        
g_iPlayerItem[id][g_CurrentChar[id]][item_id]++;
    }
    } 
I have these codes and these codes provides getting items. With this codes, I get 8 item in a certain order.
First item : A, second: B, ... last item:H (Total 8 item)
Request: I want to get only one item randomly that "g_iPlayerItem[id][g_CurrentChar[id]][item_id]++" code. Can you help me?

Last edited by tepegoz; 12-11-2020 at 16:33.
tepegoz is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-11-2020 , 13:33   Re: get random one item
Reply With Quote #2

Code:
g_iPlayerItem[id][g_CurrentChat[id]][random(sizeof(g_iPlayerItem[id][]))]

If it doesn't work, try:

Code:
g_iPlayerItem[id][g_CurrentChat[id]][random(sizeof(g_iPlayerItem[]))]
__________________


Dear admins. If somehow you managed to read this, plz fix.

Last edited by OciXCrom; 12-11-2020 at 13:33.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
tepegoz
Senior Member
Join Date: Apr 2019
Old 12-11-2020 , 16:34   Re: get random one item
Reply With Quote #3

thanks.
tepegoz is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:16.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode