Raised This Month: $ Target: $400
 0% 

Anyone can check this code if it's correct?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LJC
Member
Join Date: Jul 2014
Old 11-14-2014 , 16:26   Anyone can check this code if it's correct?
Reply With Quote #1

Hi, somehow I think that this my "home-made" plugin causes this error on my server:

sz_getspace: overflow on

Can anyone check if this code is written correctly and doesn't spam any commands to the client? Thanks.


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

new num
new map[32]
new pCvar_enableswap
new pCvar_swapround
new pCvar_boost
new pCvar_hidetime

public plugin_init()
{
	register_plugin("PapildomiLJC", "1.2", "arbata");
    get_mapname(map, charsmax(map)) 
	pCvar_enableswap = register_cvar("mp_swapspawns", "0")
	pCvar_swapround = register_cvar("mp_swapround", "0")
	pCvar_boost = register_cvar("hns_semiclip", "0")
	pCvar_hidetime = register_cvar("hns_hidetime", "20")
	set_task(3.0, "hns_mod")
	set_task(8.0, "check_random")
}

public check_random()
{
	num = random_num(5, 10);
	set_pcvar_num(pCvar_enableswap, 2)
	set_pcvar_num(pCvar_swapround, num)
}

public hns_mod()
{
	if(containi(map, "hns_") != -1) {     
        set_pcvar_num(pCvar_boost, 1);
		set_pcvar_num(pCvar_hidetime, 10);
    }
	else if(containi(map, "rayish_") != -1) {     
        set_pcvar_num(pCvar_boost, 1);
		set_pcvar_num(pCvar_hidetime, 10);
    }
	else if(containi(map, "c21_") != -1) {     
        set_pcvar_num(pCvar_boost, 1);
		set_pcvar_num(pCvar_hidetime, 10);
    } 
}
LJC is offline
Eagle07
Veteran Member
Join Date: May 2014
Location: Morocco :D
Old 11-15-2014 , 05:06   Re: Anyone can check this code if it's correct?
Reply With Quote #2

try to add
Code:
public hns_mod()
{
	get_mapname(map, charsmax(map) - 1);
	if(containi(map, "hns_") != -1) {     
		set_pcvar_num(pCvar_boost, 1);
		set_pcvar_num(pCvar_hidetime, 10);
	}
	else if(containi(map, "rayish_") != -1) {     
		set_pcvar_num(pCvar_boost, 1);
		set_pcvar_num(pCvar_hidetime, 10);
	}
	else if(containi(map, "c21_") != -1) {     
		set_pcvar_num(pCvar_boost, 1);
		set_pcvar_num(pCvar_hidetime, 10);
	} 
}
__________________
Eagle07 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-15-2014 , 06:03   Re: Anyone can check this code if it's correct?
Reply With Quote #3

Code:
get_mapname(map, charsmax(map) - 1);
You have no ideea what you are doing. charsmax already do sizeof -1 so you would have sizeof-2
__________________
HamletEagle 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 17:40.


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