Raised This Month: $ Target: $400
 0% 

if (!cvar_g && !cvar_g) Help.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 04-24-2011 , 16:24   if (!cvar_g && !cvar_g) Help.
Reply With Quote #1

Hello.

Is that code correct ?

PHP Code:
 if (g_handle_models_on_separate_ent)
 {
  
// Set the right model
  
if (g_nemesis[id])
  {
    if (!
g_weskerround && !g_lnjround)
    
iRand random_num(0ArraySize(model_nemesis) - 1)
    
ArrayGetString(model_nemesisiRandg_playermodel[id], charsmax(g_playermodel[]))
    if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_nemesisiRand))
  }
  else if (
g_weskerround && g_lnjround)
  {
   if (
g_nemesis[id])
   
iRand random_num(0ArraySize(model_nemesis2) - 1)
   
ArrayGetString(model_nemesis2iRandg_playermodel[id], charsmax(g_playermodel[]))
   if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_nemesis2iRand))
  }
  else if (
g_assassin[id])
  {
   
iRand random_num(0ArraySize(model_assassin) - 1)
   
ArrayGetString(model_assassiniRandg_playermodel[id], charsmax(g_playermodel[]))
   if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_assassiniRand))
  }
  else
  {
   if (
get_pcvar_num(cvar_adminmodelszombie) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
   {
    
iRand random_num(0ArraySize(model_admin_zombie) - 1)
    
ArrayGetString(model_admin_zombieiRandg_playermodel[id], charsmax(g_playermodel[]))
    if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_admin_zombieiRand))
   }
   else
   {
    
iRand random_num(ArrayGetCell(g_zclass_modelsstartg_zombieclass[id]), ArrayGetCell(g_zclass_modelsendg_zombieclass[id]) - 1)
    
ArrayGetString(g_zclass_playermodeliRandg_playermodel[id], charsmax(g_playermodel[]))
    if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_zclass_modelindexiRand))
   }
  } 
.Dare Devil. is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 04-24-2011 , 16:40   Re: if (!cvar_g && !cvar_g) Help.
Reply With Quote #2

Let me clean that up for you so YOU can see what you're doing.
PHP Code:
if (g_handle_models_on_separate_ent)
{
    
// Set the right model
    
if (g_nemesis[id])
    {
        if (!
g_weskerround && !g_lnjround)
            
iRand random_num(0ArraySize(model_nemesis) - 1)

        
ArrayGetString(model_nemesisiRandg_playermodel[id], charsmax(g_playermodel[]))

        if (
g_set_modelindex_offset)
            
fm_cs_set_user_model_index(idArrayGetCell(g_modelindex_nemesisiRand))
    }
    else if (
g_weskerround && g_lnjround)
    {
        if (
g_nemesis[id])
            
iRand random_num(0ArraySize(model_nemesis2) - 1)

        
ArrayGetString(model_nemesis2iRandg_playermodel[id], charsmax(g_playermodel[]))

        if (
g_set_modelindex_offset)
            
fm_cs_set_user_model_index(idArrayGetCell(g_modelindex_nemesis2iRand))
    }
    else if (
g_assassin[id])
    {
        
iRand random_num(0ArraySize(model_assassin) - 1)
        
ArrayGetString(model_assassiniRandg_playermodel[id], charsmax(g_playermodel[]))

        if (
g_set_modelindex_offset)
            
fm_cs_set_user_model_index(idArrayGetCell(g_modelindex_assassiniRand))
    }
    else
    {
        if (
get_pcvar_num(cvar_adminmodelszombie) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
        {
            
iRand random_num(0ArraySize(model_admin_zombie) - 1)
            
ArrayGetString(model_admin_zombieiRandg_playermodel[id], charsmax(g_playermodel[]))

            if (
g_set_modelindex_offset)
                
fm_cs_set_user_model_index(idArrayGetCell(g_modelindex_admin_zombieiRand))
        }
        else
        {
            
iRand random_num(ArrayGetCell(g_zclass_modelsstartg_zombieclass[id]), ArrayGetCell(g_zclass_modelsendg_zombieclass[id]) - 1)
            
ArrayGetString(g_zclass_playermodeliRandg_playermodel[id], charsmax(g_playermodel[]))

            if (
g_set_modelindex_offset)
                
fm_cs_set_user_model_index(idArrayGetCell(g_zclass_modelindexiRand))
        }
    }
// No ending "}" ? 
So, is that code correct ?

I am actually asking you because I don't really have the patience to understand what you're trying to do.

Title is confusing btw.
__________________
Hunter-Digital is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 04-26-2011 , 16:56   Re: if (!cvar_g && !cvar_g) Help.
Reply With Quote #3

Is that code right?

PHP Code:
  if (g_nemesis[id])
  {
    if (
g_weskerround && g_lnjround)
    {
    
iRand random_num(0ArraySize(model_nemesis2) - 1)
    
ArrayGetString(model_nemesis2iRandg_playermodel[id], charsmax(g_playermodel[]))
    if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_nemesis2iRand))
   }
   else
   {
    
iRand random_num(0ArraySize(model_nemesis) - 1)
    
ArrayGetString(model_nemesisiRandg_playermodel[id], charsmax(g_playermodel[]))
    if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_nemesisiRand))
   }
  }
  else if (
g_assassin[id])
  {
   
iRand random_num(0ArraySize(model_assassin) - 1)
   
ArrayGetString(model_assassiniRandg_playermodel[id], charsmax(g_playermodel[]))
   if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_assassiniRand)) 
And this

PHP Code:
  if (g_nemesis[id])
  {
   
size ArraySize(model_nemesis)
   for (
0sizei++)
   {
    if (
g_weskerround && g_lnjround)
    {
     
ArrayGetString(model_nemesis2itempmodelcharsmax(tempmodel))
     if (
equal(currentmodeltempmodel)) already_has_model true
    
}
    else
    {
     
ArrayGetString(model_nemesisitempmodelcharsmax(tempmodel))
     if (
equal(currentmodeltempmodel)) already_has_model true
    
}
   }
   if (!
already_has_model)
   {
    if (
g_weskerround && g_lnjround)
    {
     
iRand random_num(0size 1)
     
ArrayGetString(model_nemesis2iRandg_playermodel[id], charsmax(g_playermodel[]))
     if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_nemesis2iRand))
    }
    else
    {
     
iRand random_num(0size 1)
     
ArrayGetString(model_nemesisiRandg_playermodel[id], charsmax(g_playermodel[]))
     if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_nemesisiRand))
    }
   }
  }
  else if (
g_assassin[id])
  {
   
size ArraySize(model_assassin)
   for (
0sizei++)
   {
    
ArrayGetString(model_assassinitempmodelcharsmax(tempmodel))
    if (
equal(currentmodeltempmodel)) already_has_model true
   
}
   
   if (!
already_has_model)
   {
    
iRand random_num(0size 1)
    
ArrayGetString(model_assassiniRandg_playermodel[id], charsmax(g_playermodel[]))
    if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_assassiniRand))
   }
  } 
It must works like that if g_weskerround or g_lnjround
then nemesis model must be "model_nemesis2"

and when are other mode then nemesis model is "model_nemesis"
.Dare Devil. is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 04-26-2011 , 17:09   Re: if (!cvar_g && !cvar_g) Help.
Reply With Quote #4

I found a problem and solved it.
Thanks for read alliedmodders

Here is working code
PHP Code:
 
 
if (g_nemesis[id])
  {
    if (
g_weskerround)
    {
    
iRand random_num(0ArraySize(model_nemesis2) - 1)
    
ArrayGetString(model_nemesis2iRandg_playermodel[id], charsmax(g_playermodel[]))
    if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_nemesis2iRand))
   }
   else if (
g_lnjround)
    {
    
iRand random_num(0ArraySize(model_nemesis2) - 1)
    
ArrayGetString(model_nemesis2iRandg_playermodel[id], charsmax(g_playermodel[]))
    if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_nemesis2iRand))
   }
   else
   {
    
iRand random_num(0ArraySize(model_nemesis) - 1)
    
ArrayGetString(model_nemesisiRandg_playermodel[id], charsmax(g_playermodel[]))
    if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_nemesisiRand))
   }
  }
  else if (
g_assassin[id])
  {
   
iRand random_num(0ArraySize(model_assassin) - 1)
   
ArrayGetString(model_assassiniRandg_playermodel[id], charsmax(g_playermodel[]))
   if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_assassiniRand)) 
I see if i add 2 cvar on if() it not working.
.Dare Devil. is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 04-27-2011 , 05:34   Re: if (!cvar_g && !cvar_g) Help.
Reply With Quote #5

Quote:
Originally Posted by .Dare Devil. View Post
It must works like that if g_weskerround or g_lnjround
then nemesis model must be "model_nemesis2"

and when are other mode then nemesis model is "model_nemesis"
Well you obviously don't understand conditions... because you said it yourself: g_weskerround or g_lnjround, and that is:
Code:
if(g_weskerround || g_lnjround)
{
   //...
}
__________________
Hunter-Digital is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 04-27-2011 , 06:22   Re: if (!cvar_g && !cvar_g) Help.
Reply With Quote #6

Quote:
Originally Posted by Hunter-Digital View Post
Well you obviously don't understand conditions... because you said it yourself: g_weskerround or g_lnjround, and that is:
Code:
if(g_weskerround || g_lnjround)
{
   //...
}
No its not working.
Working only that what i post and i say that is correct
.Dare Devil. is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 04-27-2011 , 11:01   Re: if (!cvar_g && !cvar_g) Help.
Reply With Quote #7

Quote:
Originally Posted by .Dare Devil. View Post
No its not working.
Working only that what i post and i say that is correct
Whatever then, you seriously don't understand conditions if you can't use a simple OR condition instead of multiple if-else.
__________________
Hunter-Digital is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 04-27-2011 , 12:10   Re: if (!cvar_g && !cvar_g) Help.
Reply With Quote #8

Quote:
Originally Posted by Hunter-Digital View Post
Whatever then, you seriously don't understand conditions if you can't use a simple OR condition instead of multiple if-else.
But i try this way it not working.
But thanks for try help me.
.Dare Devil. is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-27-2011 , 14:56   Re: if (!cvar_g && !cvar_g) Help.
Reply With Quote #9

.Dare Devil.
You say this don't work?
PHP Code:
if (g_nemesis[id])
{
    if ((
g_weskerround)||(g_lnjround))
    {
        
iRand random_num(0ArraySize(model_nemesis2) - 1)
        
ArrayGetString(model_nemesis2iRandg_playermodel[id], charsmax(g_playermodel[]))
        if (
g_set_modelindex_offset
            
fm_cs_set_user_model_index(idArrayGetCell(g_modelindex_nemesis2iRand))
    }
    else
    {
        
iRand random_num(0ArraySize(model_nemesis) - 1)
        
ArrayGetString(model_nemesisiRandg_playermodel[id], charsmax(g_playermodel[]))
        if (
g_set_modelindex_offset
            
fm_cs_set_user_model_index(idArrayGetCell(g_modelindex_nemesisiRand))
    }
}
else if (
g_assassin[id])
{
    
iRand random_num(0ArraySize(model_assassin) - 1)
    
ArrayGetString(model_assassiniRandg_playermodel[id], charsmax(g_playermodel[]))
    if (
g_set_modelindex_offset
        
fm_cs_set_user_model_index(idArrayGetCell(g_modelindex_assassiniRand))

__________________


Last edited by SonicSonedit; 04-27-2011 at 15:00.
SonicSonedit is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 04-27-2011 , 16:00   Re: if (!cvar_g && !cvar_g) Help.
Reply With Quote #10

it is same what i do
.Dare Devil. 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 19:57.


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