AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get server ip! (https://forums.alliedmods.net/showthread.php?t=144512)

SpyDevil 12-04-2010 22:15

get server ip!
 
hi guyz. I want to edit a plugin for new things but i have problem.


plugin original:

PHP Code:

new szTga[TGASUM][] ={
"gfx/banner.tga"


but i want change this;
PHP Code:

new szTga[TGASUM][] ={
"gfx/%serverip%.tga"


how can i do this pls ?

fysiks 12-04-2010 23:01

Re: get server ip!
 
Search.

SpyDevil 12-04-2010 23:09

Re: get server ip!
 
i searching since two days but i couldnt find true codes.. Also i dont know good programming.. Ex: https://forums.alliedmods.net/showthread.php?p=1062792 bla bla...

Exolent[jNr] 12-05-2010 02:48

Re: get server ip!
 
Don't bump until 2 weeks have passed since last post.

SpyDevil 12-05-2010 06:37

Re: get server ip!
 
ok sorry

lucas_7_94 12-05-2010 18:01

Re: get server ip!
 
what are you tryting to say with %serverip% ?

fysiks 12-05-2010 18:03

Re: get server ip!
 
Quote:

Originally Posted by lucas_7_94 (Post 1364099)
what are you tryting to say with %serverip% ?

He wants it replaced with the server's IP.

wrecked_ 12-05-2010 18:03

Re: get server ip!
 
You must format the string.

Example:
Code:
new file[64] func() {     new serverip[32]     get_user_ip( 0, serverip, 31 ) // gets ip of server     formatex( file, 63, "gfx/%s.tga", serverip ) }

SpyDevil 12-05-2010 19:20

Re: get server ip!
 
Quote:

Originally Posted by wrecked_ (Post 1364103)
You must format the string.

Example: Code:
new file[64] func() { new serverip[32] get_user_ip( 0, serverip, 31 ) // gets ip of server formatex( file, 63, "gfx/%s.tga", serverip ) }


thanks bro. I tried this but server crashes and i take this error when compile sma:

PHP Code:

spec_banner_ads.sma(102) : warning 203symbol is never used"func" 


SpyDevil 12-05-2010 19:45

Re: get server ip!
 
PHP Code:

#define PLUGIN  "Spectator Banner Ads"
#define VERSION "0.1.16"
#define AUTHOR  "iG_os"

#include <amxmodx>

#define SVC_DIRECTOR 51  // come from util.h
#define DRC_CMD_BANNER 9 // come from hltv.h

new szTga[64
func() {     
new 
serverip[32]     
get_user_ip0serverip31 // gets ip of server     
formatexszTga63"gfx/%s.tga"serverip 
}

new 
pCVAR_Tga
new g_SendOnce[33]

public 
plugin_precache()
{
   
register_plugin(PLUGINVERSIONAUTHOR)
   
register_logevent("joined_team"3"1=joined team")

   
pCVAR_Tga register_cvar("spec_banner_ads""1")

   if (
get_pcvar_num(pCVAR_Tga))
   {
      for (new 
i=0i<1i++)
         
precache_generic(szTga[i])
   }
}


public 
client_putinserver(id)
{
   
g_SendOnce[id] = true
}


public 
joined_team()
{
   new 
loguser[80], name[32]
   
read_logargv(0loguser79)
   
parse_loguser(logusername31)
   new 
id get_user_index(name)

   if ( 
get_pcvar_num(pCVAR_Tga) && g_SendOnce[id] && is_user_connected(id) )
   {
      
// random select one tga
      
new index random_num01)
      
g_SendOnce[id] = false

      
// send show tga command to client
      
message_beginMSG_ONESVC_DIRECTOR_id )
      
write_bytestrlenszTga[index]) + // command length in bytes
      
write_byteDRC_CMD_BANNER )
      
write_stringszTga[index] ) // banner file
      
message_end()
   }



last coded... but i take error when i installed to server :(


All times are GMT -4. The time now is 11:23.

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