Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSSDifferent messages controlled by if statemenets


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
Hello, Im trying to add different cvars and have them each show a different message when they are enabled.
I have 5-6 cvars(kz_nfs, kz_wayz ,icevip ,newicevip ,sxj) and i want to combine them with another cvar(kz_chatinfo) and what i want to achieve is the following:

If any of the cvars is enabled WITH kz_chatinfo ENABLED ==> Different Message for each cvar
If any of the cvars is enabled WITH kz_chatinfo DISABLED ==> Different message for each cvar
If NONE of the cvars is enabled AND kz_chatinfo is DISABLED ==> another message (Default message) when everything is disabled.

Whenever i try to use If and else if for each it just wont compile saying either invalid expressions, or expected ";" and found "if" or ")" and when it finally DOES compile, all the messages show at the same time, like the cvars arent doing or controlling anything. Im attaching the plugin and posting the code of the problem area in the post. Hopeflly someone can save me from this hell
EDIT: Just posted the full plugin files and an updated sma file. The file compiles fine now but the issue is that all the message appear at once, not when each cvar is enabled. Like even if all/most(?) of them are off, it still gives 6 different messages.

PHP Code:

                                        if(get_pcvar_num(kz_nfs) && get_pcvar_num(kz_chatinfo))
                                        {
                                            
ColorChat(idsRED"^3[%s] %s %s'd %.3f units! Strafes: %i Sync: %i%% ^1%s%s%s"prefixg_playername[id], Jtype[id], distance[id], strafe_num[id], sync_[id], block_strweapon_namepre_type[id]);
                                        }
                                        else if (
get_pcvar_num(kz_nfs))
                                        
ColorChat(idsRED,"^3[%s] %s %s'd %.3f units! %i%% ^1%s%s%s",prefixg_playername[id],Jtype[id],distance[id],block_str,weapon_name,pre_type[id]);
                                        else 
                                        {
                                            if(
jump_type[id]==Type_LongJump||jump_type[id]==Type_HighJump)
                                            
ColorChat(idsRED,"^1[%s] ^3%s jumped %.3f units! ^1%s%s%s",prefixg_playername[id], distance[id],block_str,weapon_name,pre_type[id]);
                                            else
                                            
ColorChat(idsRED,"^1[%s] ^3%s jumped %.3f units with %s! ^1%s%s%s",prefixg_playername[id], distance[id],Jtype1[id],block_str,weapon_name,pre_type[id]);
                                        }                                    
                                        if(
get_pcvar_num(kz_wayz) && get_pcvar_num(kz_chatinfo))
                                        {
                                            
ColorChat(idsRED,"^1[%s] ^4%s ^1%s Distance: ^3%.1f ^1Pre: ^3%.1f ^1Strafes: ^3%i ^1Sync: ^3%i%% %s%s%s"prefix,g_playername[id],Jtype[id],distance[id],prestrafe[id],strafe_num[id],sync_[id],block_str,weapon_name,pre_type[id]);
                                        }
                                        else if(
get_pcvar_num(kz_wayz))
                                        
ColorChat(idsRED,"^1[%s] ^4%s ^1%s Distance: ^3%.1f ^1Pre: ^3%.1f ^1Strafes: ^3%i ^1Sync: ^3%i%% %s%s%s"prefix,g_playername[id],Jtype[id],distance[id],prestrafe[id],strafe_num[id],sync_[id],block_str,weapon_name,pre_type[id]);
                                        else 
                                        {
                                            if(
jump_type[id]==Type_LongJump||jump_type[id]==Type_HighJump)
                                            
ColorChat(idsRED,"^1[%s] ^3%s jumped %.3f units! ^1%s%s%s",prefixg_playername[id], distance[id],block_str,weapon_name,pre_type[id]);
                                            else
                                            
ColorChat(idsRED,"^1[%s] ^3%s jumped %.3f units with %s! ^1%s%s%s",prefixg_playername[id], distance[id],Jtype1[id],block_str,weapon_name,pre_type[id]);
                                        }                                    
                                        if(
get_pcvar_num(kz_icevip) && get_pcvar_num(kz_chatinfo))
                                        {
                                            
ColorChat(idsRED,"^3[%s] %s jumped %.3f units with %s on %s like a BOSS! Strafes: %i Sync: %i%% ^1%s%s",prefixg_playername[id],distance[id],Jtype[id],block_str,strafe_num[id],sync_[id],weapon_name,pre_type[id]);
                                        }
                                        else if(
get_pcvar_num(kz_icevip))
                                        
ColorChat(idsRED,"^3[%s] %s jumped %.3f units with %s on %s like a BOSS! ^1%s%s",prefixg_playername[id],distance[id],Jtype[id],block_str,weapon_name,pre_type[id]);
                                        else 
                                        {
                                            if(
jump_type[id]==Type_LongJump||jump_type[id]==Type_HighJump)
                                            
ColorChat(idsRED,"^1[%s] ^3%s jumped %.3f units! ^1%s%s%s",prefixg_playername[id], distance[id],block_str,weapon_name,pre_type[id]);
                                            else
                                            
ColorChat(idsRED,"^1[%s] ^3%s jumped %.3f units with %s! ^1%s%s%s",prefixg_playername[id], distance[id],Jtype1[id],block_str,weapon_name,pre_type[id]);
                                        }
                                        if(
get_pcvar_num(kz_nfsicevip) && get_pcvar_num(kz_chatinfo))
                                        {
                                            
ColorChat(idsRED,"^3[%s] %s %s'd %.3f units on %s like a BOSS! Strafes: %i Sync: %i%% ^1%s%s",prefixg_playername[id],Jtype[id],distance[id],block_str,strafe_num[id],sync_[id],weapon_name,pre_type[id]);
                                        }    
                                        else if(
get_pcvar_num(kz_nfsicevip))
                                        
ColorChat(idsRED,"^3[%s] %s %s'd %.3f units on %s like a BOSS! Strafes: %i Sync: %i%% ^1%s%s",prefixg_playername[id],Jtype[id],distance[id],block_str,strafe_num[id],sync_[id],weapon_name,pre_type[id]);
                                        else 
                                        {
                                            if(
jump_type[id]==Type_LongJump||jump_type[id]==Type_HighJump)
                                            
ColorChat(idsRED,"^1[%s] ^3%s jumped %.3f units! ^1%s%s%s",prefixg_playername[id], distance[id],block_str,weapon_name,pre_type[id]);
                                            else
                                            
ColorChat(idsRED,"^1[%s] ^3%s jumped %.3f units with %s! ^1%s%s%s",prefixg_playername[id], distance[id],Jtype1[id],block_str,weapon_name,pre_type[id]);
                                        }
                                        if(
get_pcvar_num(kz_newicevip) && get_pcvar_num(kz_chatinfo))
                                        {
                                            
ColorChat(idsRED,"^1[%s] ^3%s jumped %.3f units %s with %i strafes and %i%% sync on %s like a BOSS! ^1%s%s",prefixg_playername[id], distance[id],Jtype[id],strafe_num[id],sync_[id],block_str,weapon_name,pre_type[id]);
                                        }
                                        else if(
get_pcvar_num(kz_newicevip))
                                        
ColorChat(idsRED,"^1[%s] ^3%s jumped %.3f units %s on %s like a BOSS! ^1%s%s",prefixg_playername[id], distance[id],Jtype[id],block_str,weapon_name,pre_type[id]);
                                        else 
                                        {
                                            if(
jump_type[id]==Type_LongJump||jump_type[id]==Type_HighJump)
                                            
ColorChat(idsRED,"^1[%s] ^3%s jumped %.3f units! ^1%s%s%s",prefixg_playername[id], distance[id],block_str,weapon_name,pre_type[id]);
                                            else
                                            
ColorChat(idsRED,"^1[%s] ^3%s jumped %.3f units with %s! ^1%s%s%s",prefixg_playername[id], distance[id],Jtype1[id],block_str,weapon_name,pre_type[id]);
                                        }
                                        if(
get_pcvar_num(kz_sxj) && get_pcvar_num(kz_chatinfo) && jump_type[id] == Type_LongJump || jump_type[id] == Type_HighJump)
                                        {
                                            
ColorChat(idsRED"^1[%s] ^3%s jumped %.3f units! Strafes: %i Sync: %i%% ^1%s%s%s"prefixg_playername[id], distance[id], strafe_num[id], sync_[id], block_strweapon_namepre_type[id]);
                                        }
                                        else if(
get_pcvar_num(kz_sxj))
                                        
ColorChat(idsRED"^1[%s] ^3%s jumped %.3f units! ^1%s%s%s"prefixg_playername[id], distance[id], block_strweapon_namepre_type[id]);
                                        else 
                                        {
                                            if(
jump_type[id]==Type_LongJump||jump_type[id]==Type_HighJump)
                                            
ColorChat(idsRED,"^1[%s] ^3%s jumped %.3f units! ^1%s%s%s",prefixg_playername[id], distance[id],block_str,weapon_name,pre_type[id]);
                                            else
                                            
ColorChat(idsRED,"^1[%s] ^3%s jumped %.3f units with %s! ^1%s%s%s",prefixg_playername[id], distance[id],Jtype1[id],block_str,weapon_name,pre_type[id]);
                                        }
                                    } 


Attached Files
File Type: sma Get Plugin or Get Source (plugin-test.sma - 410.2 KB)
File Type: zip uq_jumpstats_v2.51.zip (654.7 KB)

Przeczytaj cały wpis

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...