Raised This Month: $ Target: $400
 0% 

some logs for plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 08-09-2013 , 13:48   Re: some logs for plugin
Reply With Quote #1

You must check if the player is connected whenever you use set_task. Players can disconnect before the task ends.

Here your solution to prevent that error

PHP Code:
#include <amxmodx> 
#include <fun> 
#include <hamsandwich> 

#define PLUGIN "Spawn Heal" 
#define VERSION "1.0" 
#define AUTHOR "RedRobster" 

public plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR
    
    
RegisterHam(Ham_Spawn,"player","Spawn_Hook",1


public 
Spawn_Hook(id

    
set_task(1.0,"Heal_User",id,_,_,"a",5

public 
Heal_User(id

    if(
is_user_alive(id) && is_user_connected(id)) 
    {
        
set_user_health(id,100
    }
    else 
remove_task(id)


Plus why are you setting players' health to 100 five times ? If you want to make a spawn protection, it is very poor way.

Last edited by akcaliberg; 08-09-2013 at 13:51.
akcaliberg 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 15:50.


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