Raised This Month: $51 Target: $400
 12% 

Model Set


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 04-09-2018 , 17:24   Model Set
Reply With Quote #1

Hi ther, I want to choose models whitch i want set by cvar
example!
PHP Code:
#define MAX_MODEL 10 
new const supplybox_modelMAX_MODEL ][ ] = 

    
"models/supplybox/supplybox.mdl"//a or 1
    
"models/supplybox/supplybox2.mdl"//b or 2
    
"models/supplybox/supplybox_rex.mdl"//c or 3
    
"models/supplybox/supplybox_rex2.mdl"//d or 4
    
"models/supplybox/supplybox_hms.mdl"//e or 5
    
"models/supplybox/supplybox_biohazard.mdl"//f or 6
    
"models/supplybox/supplybox_umbrella.mdl"//g or 7
    
"models/supplybox/supplybox_umbrela2.mdl"//h or 8
    
"models/supplybox/supplybox_zbs.mdl"//i or 9
    
"models/supplybox/supplybox_classic.mdl" //j or 10

Prechase
PHP Code:
    for( new 0sizeofsupplybox_model ); i++ )
        
precache_modelsupplybox_model] ) 
Set model
PHP Code:
        entity_set_modelentsupplybox_modelrandom_num0MAX_MODEL -) ] ) 
what i want is a config cvar to se at example i want supplybox_zbs and supplybox_hms models and i want set them as
cvar : sb_model_choosed "ei"
or cvar: sb_model_choosed "59"
__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 04-09-2018 , 17:25   Re: Model Set
Reply With Quote #2

Succed in this way but need to set models whitch they are toghter

PHP Code:
    cvar_model_start   register_cvar"sb_model_start""1" 
    
cvar_model_end     register_cvar"sb_model_end""9" 
PHP Code:
    new ModelStartModelEnd 
PHP Code:
    ModelStart get_pcvar_numcvar_model_start ) - 
    ModelEnd 
get_pcvar_numcvar_model_end ) - 
    
    
if( ModelStart || ModelStart >= MAX_MODEL 
        
ModelStart 
        
    
if( ModelEnd >= MAX_MODEL || ModelEnd 
        
ModelEnd MAX_MODEL 
        
    
if( ModelEnd ModelStart 
    { 
        
ModelStart 
        ModelEnd 
MAX_MODEL 
    

__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 04-09-2018 , 17:55   Re: Model Set
Reply With Quote #3

You can create an array which holds the chars that you need, in order to connect perfectly with the numbers, the string located. If 'a' is on X array, then we get the 'a' array of Y and set it. Or you could just extend the array.
Code:
new array = {     { "one", 1 },     { "two", 2 },     { "three", 3 },     { "four", 4 } }
__________________

Last edited by Relaxing; 04-09-2018 at 17:57. Reason: Just add the missing []s
Relaxing is offline
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 04-09-2018 , 18:09   Re: Model Set
Reply With Quote #4

Quote:
Originally Posted by Relaxing View Post
You can create an array which holds the chars that you need, in order to connect perfectly with the numbers, the string located. If 'a' is on X array, then we get the 'a' array of Y and set it. Or you could just extend the array.
Code:
new array = {     { "one", 1 },     { "two", 2 },     { "three", 3 },     { "four", 4 } }
out from my thread! i cant to explain for stupid...learn pawn then come with something new...
__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 04-10-2018 , 03:47   Re: Model Set
Reply With Quote #5

You're right. I should be out of this thread. But keep in mind, you ain't got that much logic to do it yourself. I learn pawn, you learn english. English es muy importante mi amigo. 12yo boi strikes a verb. RIP dextar
__________________
Relaxing is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-10-2018 , 11:08   Re: Model Set
Reply With Quote #6

Quote:
Originally Posted by D3XT3R View Post
out from my thread! i cant to explain for stupid...learn pawn then come with something new...
You cant tell some1 to not comment on your threads its a freewill, he is trying to help you as i can see your description is totally not-understandable make sure to fix all your typing mistakes, and one more thing be respectful to gain respect.

OP your problem will be solved by setting a bitsum value for each flag

PHP Code:
enum |=  (1<<
{
   
Supplybox 0,
   
Supplybox2,
   
SupplyboxRex,
   
SupplyboxRex2,
   
SupplyboxHms,
   
SupplyboxBio
   SupplyboxUmb
,
   
SupplyboxUmb2,
   
SupplyboxZbs,
   
SupplyboxClassic }

public 
get_random_supplybox_mdl()
{
   new 
szFlags[12]
   
get_pcvar_string(cvar_modelszFlags11)

   new 
iChosen read_flags(szFlag[clamp(random(strlen(szFlags)), 0charsmax(supplybox_model)]);
   
   for(new 
supplybox_model;i++)
   {
      if(
iChosen == (1<<i))
            return 
i;
   }
   return 
0;
}


// latter on .....
entity_set_modelentsupplybox_modelget_random_supplybox_mdl() ] ) 
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 04-10-2018 at 11:33.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 04-10-2018 , 11:47   Re: Model Set
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
You cant tell some1 to not comment on your threads its a freewill, he is trying to help you as i can see your description is totally not-understandable make sure to fix all your typing mistakes, and one more thing be respectful to gain respect.

OP your problem will be solved by setting a bitsum value for each flag

PHP Code:
enum |=  (1<<
{
   
Supplybox 0,
   
Supplybox2,
   
SupplyboxRex,
   
SupplyboxRex2,
   
SupplyboxHms,
   
SupplyboxBio
   SupplyboxUmb
,
   
SupplyboxUmb2,
   
SupplyboxZbs,
   
SupplyboxClassic }

public 
get_random_supplybox_mdl()
{
   new 
szFlags[12]
   
get_pcvar_string(cvar_modelszFlags11)

   new 
iChosen read_flags(szFlag[clamp(random(strlen(szFlags)), 0charsmax(supplybox_model)]);
   
   for(new 
supplybox_model;i++)
   {
      if(
iChosen == (1<<i))
            return 
i;
   }
   return 
0;
}


// latter on .....
entity_set_modelentsupplybox_modelget_random_supplybox_mdl() ] ) 
Ty Natsheh, I dont know why i start love you
__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 04-10-2018 , 12:45   Re: Model Set
Reply With Quote #8

natsheh do i need to make an array?
__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-10-2018 , 12:56   Re: Model Set
Reply With Quote #9

The enum not needed just for readability since you are getting a random value
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Reply



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 18:29.


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