Raised This Month: $32 Target: $400
 8% 

Solved Small function crashing server without error logs


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 04-15-2019 , 08:18   Small function crashing server without error logs
Reply With Quote #1

PHP Code:
new sv_password
public plugin_init(){
  
sv_password get_cvar_pointer"sv_password" );
  
register_concmd("amx_pass""passfunc"ADMIN_KICK"duhh")
}


public 
passfunc(id){
    new 
pass random_num(0,10000)
    new 
currpass32 ];
    
get_pcvar_stringsv_password currpass charsmaxcurrpass ) );
    if(
get_pcvar_num(currpass] == EOS )){
        
set_cvar_num("sv_password"pass);
    }
    if(
get_pcvar_num(currpass] != EOS )){
        
set_cvar_string("sv_password","");
    }

basically, this stuff's crashing my server without any error log
__________________

Last edited by deprale; 04-15-2019 at 13:04.
deprale is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 04-15-2019 , 09:22   Re: Small function crashing server without error logs
Reply With Quote #2

Code:
public passfunc(id){     new pass = random_num(0,10000)     new currpass[ 32 ];     get_pcvar_string( sv_password , currpass , charsmax( currpass ) );     //if(get_pcvar_num(currpass[ 0 ] == EOS )){     if (equal(currpass, "EOS")) {         set_cvar_num("sv_password", pass);     }     else {         set_cvar_string("sv_password","");     } }
__________________








CrazY. is offline
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 04-15-2019 , 13:04   Re: Small function crashing server without error logs
Reply With Quote #3

Thanks CrazY, can always rely on you

EDIT: THOUGHT I MIGHT SHARE IT, it actually didnt work, it did compile though but it never passed the first if, only the "else" statement somehow.
ALTHOUGH - you can use strlen(currpass) == 0 instead of EQUAL EOS and fix the problem.
__________________

Last edited by deprale; 04-15-2019 at 18:02.
deprale is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-16-2019 , 07:57   Re: Small function crashing server without error logs
Reply With Quote #4

Yeah the equal "EOS" doesn't make sense. It should be currpass[0] == EOS
__________________
HamletEagle is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-16-2019 , 09:01   Re: Small function crashing server without error logs
Reply With Quote #5

btw if you are using a version of amx modx doesnt have EOS in defines EOS is equal to 0..

EOS : End Of String
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 04-16-2019 , 14:02   Re: Small function crashing server without error logs
Reply With Quote #6

Thanks @HamletEagle, @Natsheh, for the added info!
__________________
deprale is offline
Reply


Thread Tools
Display Modes

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 15:54.


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