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

Hello could someone fix my scripting noob talent :)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
waizedzzy
Member
Join Date: May 2016
Location: France
Old 02-12-2017 , 07:27   Hello could someone fix my scripting noob talent :)
Reply With Quote #1

Hello guys, i tried to edit a plugin and i get some errors when i compile it in webcompiler.
Here the original plugin: https://forums.alliedmods.net/showthread.php?t=119946

My code:
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

new hud_rgb, hud_x, hud_y, hud_effects,maxplayers,hudsync, g_round = 1;

public plugin_init() {
	register_plugin("Server Side Info","1.6","wizzy")
	hud_rgb = register_cvar( "srv_hud_rgb", "0 255 0" )
	hud_x = register_cvar( "srv_hud_x", "0.11" )
	hud_y = register_cvar( "srv_hud_y", "0.00" )
	hud_effects = register_cvar( "srv_hud_effects", "0" )
	hudsync = CreateHudSyncObj()
	maxplayers = get_maxplayers()
}
public event_newround() {
    g_round++
}
public Fwd_StartFrame(id) {
		for( new id = 1; id <= maxplayers; id++ ) { 
			new ip[42],red, green, blue
			new const admins = GetTotalAdmins()
			new timeleft = get_timeleft()
			get_hud_color(red, green, blue)
			get_user_ip(0, ip, 31, 1)

set_hudmessage(red,green,blue,get_pcvar_float(hud_x),get_pcvar_float(hud_y),get_pcvar_num(hud_effects),6.0,1.0)
			ShowSyncHudMsg(id,hudsync,"|Welcome to our server|^n| Timeleft: %d:%02d|Server IP: %s^n| VIPs Online: %i ip,admins)
		}
	}
}
get_hud_color(&r, &g, &b) {
	new color[20]
	static red[5], green[5], blue[5]
	get_pcvar_string(hud_rgb, color, charsmax(color))
	parse(color, red, charsmax(red), green, charsmax(green), blue, charsmax(blue))
	r = str_to_num(red)
	g = str_to_num(green)
	b = str_to_num(blue)
}
static GetTotalAdmins() {
	new iPlayers[32],iNum,Admins
	get_players(iPlayers,iNum)
	for(new Count;Count < iNum;Count++)
		if(is_user_admin(iPlayers[Count]))
		Admins++
	return Admins
}

Errors:
Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/tmp/textqdWHMD.sma(26) : warning 217: loose indentation
/tmp/textqdWHMD.sma(27) : warning 217: loose indentation
/tmp/textqdWHMD.sma(27) : error 037: invalid string (possibly non-terminated string)

1 Error.
Could not locate output file /home/groups/amxmodx/public_html/websc3/textqdWHMD.amx (compile failed).
Help me please guys =)
__________________
Invincible Wxx ^.^
waizedzzy is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-12-2017 , 08:05   Re: Hello could someone fix my scripting noob talent :)
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

new hud_rgbhud_xhud_yhud_effects,maxplayers,hudsyncg_round 1;

public 
plugin_init() {
    
register_plugin("Server Side Info","1.6","wizzy")
    
hud_rgb register_cvar"srv_hud_rgb""0 255 0" )
    
hud_x register_cvar"srv_hud_x""0.11" )
    
hud_y register_cvar"srv_hud_y""0.00" )
    
hud_effects register_cvar"srv_hud_effects""0" )
    
hudsync CreateHudSyncObj()
    
maxplayers get_maxplayers()
}
public 
event_newround() {
    
g_round++
}
public 
Fwd_StartFrame(id) {
    for( new 
id 1id <= maxplayersid++ ) { 
        new 
ip[42],redgreenblue
        
new const admins GetTotalAdmins()
                new 
timeleft get_timeleft()
        
get_hud_color(redgreenblue)
        
get_user_ip(0ip311)
        
        
set_hudmessage(red,green,blue,get_pcvar_float(hud_x),get_pcvar_float(hud_y),get_pcvar_num

(hud_effects),6.0,1.0)
        
ShowSyncHudMsg(id,hudsync,"|Welcome to our server|^n| Timeleft: %d|Server IP: %s^n| VIPs Online: 

%i"
timeleftipadmins)
    }
}

get_hud_color(&r, &g, &b) {
    new 
color[20]
    static 
red[5], green[5], blue[5]
    
get_pcvar_string(hud_rgbcolorcharsmax(color))
    
parse(colorredcharsmax(red), greencharsmax(green), bluecharsmax(blue))
    
str_to_num(red)
    
str_to_num(green)
    
str_to_num(blue)
}

static 
GetTotalAdmins() {
    new 
iPlayers[32],iNum,Admins
    get_players
(iPlayers,iNum)
    for(new 
Count;Count iNum;Count++)
        if(
is_user_admin(iPlayers[Count]))
        
Admins++
    return 
Admins

__________________

Last edited by edon1337; 02-12-2017 at 08:07.
edon1337 is offline
waizedzzy
Member
Join Date: May 2016
Location: France
Old 02-12-2017 , 08:10   Re: Hello could someone fix my scripting noob talent :)
Reply With Quote #3

Thanks ;)
[AL] Rrofsh nga V3r$Ac3 nga usercs - me prano ne skype azydiamond.
__________________
Invincible Wxx ^.^
waizedzzy is offline
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 01:00.


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