AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need Help (https://forums.alliedmods.net/showthread.php?t=77369)

sea$oned pRo 09-11-2008 19:39

Need Help
 
I am doing an alltalk status script. I did this about 2 years ago and had it working, however i forgot how. my current script is not working.

code
Code:

17  public handle_say(id) {
18    new said[192]
19      read_args(said, 192)
20      if ( (containi(said, "alltalk") != -1 && ( containi(said, "on") != -1 ) || 21        (  containi(said, "alltalk") != -1 && (containi(said, "off") != -1 ) || 22        contain(said, "/alltalk") != -1 ) ) )
23          set_task(0.1, "print_allTalk", id)
24              return PLUGIN_CONTINUE
25   
26  }
27  public print_allTalk(user)
28  {
29      new alltalkStatus[256], authid[32]
30      new cvarnum, len, id
31   
32      get_user_authid(id, authid, 31)
33          if(is_user_admin(id))
34              if(get_cvar_num(sv_alltalk[cvarnum])==1)
35            {
36              format(alltalkStatus, 255, "%s All Talk: ON %s", COLOR]
37              }
38              else
39              {
40              format(alltalkStatus, 255, "%s All Talk: ON %s", COLOR]
41              }
42          else
43           
44              {
45              format(alltalkStatus, 255, "%s All Talk: Off %s", COLOR]
46              }
47              else
48              format(alltalkStatus, 255, "%s All Talk: Off %s", COLOR]

error
Code:

alltalkstatus.sma(32) : error 017: undefined symbole "sv_alltalk"
alltalkstatus.sma(32) : error 001: expected token: ";", but found "]"
alltalkstatus.sma(32) : error 029: invalid expression, assumed zero.


FeuerSturm 09-12-2008 00:56

Re: Need Help
 
Looks like you're in the wrong section, buddy, this is for SourceMod
scripting help.

Anyways:

PHP Code:

public print_allTalk(id
{
 new 
alltalkStatus[256]
 if(
is_user_admin(id))
 {
  if(
get_cvar_num("sv_alltalk") == 1)
  {
   
format(alltalkStatus255"%s All Talk: ON %s"COLOR]
  }
  else
  {
   
format(alltalkStatus255"%s All Talk: Off %s"COLOR]
  }
  
//show the message and do other stuff here
 
}
 return 
Plugin_Handled


hope that helps :up:

sea$oned pRo 09-12-2008 20:19

Re: Need Help
 
Sorry for the miss-post. I used your code, and added my display, this is what I am using now.

PHP Code:

public print_allTalk(id
{
 new 
alltalkStatus[256]
 if(
is_user_admin(id))
 {
  if(
get_cvar_num("sv_alltalk") == 1)
  {
 
format(alltalkStatus255"%s All Talk: ON %s"COLOR)
    
  }
  else
  {
 
format(alltalkStatus255"%s All Talk: Off %s"COLOR) <-- Line 38

  
}
  
client_print(id255alltalkStatus)
 }
 return 
PLUGIN_HANDLED


It compiles great, but in game when i use the command, I get this error:
PHP Code:

17:06:59"sea$oned pRo<1><STEAM_0><CT>" say "/alltalk"
L 09/12/2008 17:06:59String formatted incorrectly parameter 5 (total 4)
L 09/12/2008 17:06:59: [AMXXDisplaying debug trace (plugin "alltalk.amxx")
L 09/12/2008 17:06:59: [AMXXRun time error 25parameter error 
L 09
/12/2008 17:06:59: [AMXX]    [0alltalk.sma::print_allTalk (line 38

Any suggestions?

FeuerSturm 09-13-2008 07:06

Re: Need Help
 
Quote:

Originally Posted by sea$oned pRo (Post 685036)
Sorry for the miss-post. I used your code, and added my display, this is what I am using now.

PHP Code:

public print_allTalk(id
{
 new 
alltalkStatus[256]
 if(
is_user_admin(id))
 {
  if(
get_cvar_num("sv_alltalk") == 1)
  {
 
format(alltalkStatus255"%s All Talk: ON %s"COLOR)
 
  }
  else
  {
 
format(alltalkStatus255"%s All Talk: Off %s"COLOR) <-- Line 38
 
  
}
  
client_print(id255alltalkStatus)
 }
 return 
PLUGIN_HANDLED


It compiles great, but in game when i use the command, I get this error:
PHP Code:

17:06:59"sea$oned pRo<1><STEAM_0><CT>" say "/alltalk"
L 09/12/2008 17:06:59String formatted incorrectly parameter 5 (total 4)
L 09/12/2008 17:06:59: [AMXXDisplaying debug trace (plugin "alltalk.amxx")
L 09/12/2008 17:06:59: [AMXXRun time error 25parameter error 
L 09
/12/2008 17:06:59: [AMXX]    [0alltalk.sma::print_allTalk (line 38

Any suggestions?

Yes, i don't know what "COLOR" is that you're using, so showing the
complete source code would help me to help you :wink:

curlefry 09-13-2008 17:29

Re: Need Help
 
I'm no good in SourcePawn, but I have one idea I wish for you to consider as a last resort. (I wish the best for ya, though.)

Check out DJ Tsunami's Advertisements plugin:

Advertisements

He's been creative enough to add the BOOL option for boolean cvars such as sv_alltalk. What I did for my server was added a quick chat message like so, in advertisements.txt:


Code:

    {
        "type"        "S"
        "text"        "Alltalk Status: {GREEN}{BOOL:SV_ALLTALK}"
    }


Lebson506th 09-13-2008 17:39

Re: Need Help
 
That is for SM, this code is for AMX X

bl4nk 09-13-2008 17:50

Re: Need Help
 
You can find better help here. :)

curlefry 09-13-2008 18:03

Re: Need Help
 
Quote:

Originally Posted by Lebson506th (Post 685469)
That is for SM, this code is for AMX X

Oopseh. Didn't realize I was in the wrong section. :wink:

YamiKaitou 09-13-2008 18:15

Re: Need Help
 
You need another parameter in the format command. Or remove one of the %s


As per the Global Forum Rules, you need to have a descriptive topic title. If you wish for this topic to stay open, please correct the topic title before you post again.


All times are GMT -4. The time now is 03:01.

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