Thread: Array
View Single Post
MacL
Member
Join Date: May 2021
Old 05-26-2021 , 08:48   Re: Array
Reply With Quote #5

Quote:
Originally Posted by Celena Luna View Post
Create a global variable and save my_vib then use it on somearray when needed
PHP Code:
new g_vib

...

g_vib my_vib //Save your vib
switch(my_vib)
{
    case 
1:
    { 
        
somearray[0]
    }
    case 
2:
    {
        
somearray[1]
    }
    case 
3:
    {
        
somearray[2]
    }


...

client_print(idprint_chat"hi %s"somearray[g_vib]); 
Or there is dumber way is using for loop then comparing the string inside.
Once found the correct one then break the loop.
Thanks. i made a int and gave it a number in every case. then i used it inside client_print.
MacL is offline