Raised This Month: $ Target: $400
 0% 

some logs for plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
slypire
Junior Member
Join Date: May 2013
Old 08-09-2013 , 13:33   some logs for plugin
Reply With Quote #1

Hi guys, I'm new in plugins world and everything like that, I have using this plugin but there is some logs from him, can anybody give me idea how to fix this, its very simple plugin.

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)
{
 if(
is_user_alive(id))
  
set_task(1.0,"Heal_User",id,_,_,"a",5)
}
public 
Heal_User(id)
{
 
set_user_health(id,100)

And log is

[AMXX] Run time error 10: native error (native "set_user_health")


Thanks a lot for help guys!
slypire is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 08-09-2013 , 13:48   Re: some logs for plugin
Reply With Quote #2

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
slypire
Junior Member
Join Date: May 2013
Old 08-09-2013 , 14:03   Re: some logs for plugin
Reply With Quote #3

I dont know how to make spawn protection better x)
I tride Bad Spawn Preventer from xPaw and beast but its not working for me, players still get killed at start of map...
slypire is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 08-09-2013 , 14:27   Re: some logs for plugin
Reply With Quote #4

this is a simple method.

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "akcaliberg"

#define TASKID 1119

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Spawn,"player","HamPlayerSpawnPost",1)
    
    
register_event("DeathMsg","eDeath","a")
}
public 
HamPlayerSpawnPost(id) {
    
set_user_godmode(id1)
    
set_task(5.0,"RemoveGodmode",id+TASKID)
}
public 
eDeath() {
    new 
victim read_data(2)
    
set_user_godmode(victim,0)
    if(
task_exists(victim+TASKID)) remove_task(victim+TASKID)
}
public 
RemoveGodmode(id) {
    
id -= TASKID;
    
set_user_godmode(id,0)

But I think that is not recommended too.

Here is another method.

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "akcaliberg"

#define TASKID 1119
#define PROTECTION_TIME 5

new LastTimeSpawned[33];
new 
iMaxPlayers;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Spawn,"player","HamPlayerSpawn_Post",1)
    
RegisterHam(Ham_TakeDamage,"player","HamTakeDamage_Pre",0)
    
    
iMaxPlayers get_maxplayers()
}
public 
HamPlayerSpawn_Post(id) {
    
LastTimeSpawned[id] = get_systime();
}
public 
HamTakeDamage_PrevictiminflictorattackerFloat:damagetype) {
    
    if( 
<= victim <= iMaxPlayers && (get_systime() - LastTimeSpawned[victim]) <= PROTECTION_TIME  ) {
        return 
HAM_SUPERCEDE
    
}
    return 
HAM_IGNORED

It's not still the best way. I gave that methods to show you there are better ways to make a spawn protection. These can be inspiration for the beginners.

If you search you can find the advanced ones.

Last edited by akcaliberg; 08-09-2013 at 14:28.
akcaliberg is offline
slypire
Junior Member
Join Date: May 2013
Old 08-09-2013 , 14:49   Re: some logs for plugin
Reply With Quote #5

Thanks a lot, can I use some of these method on my DR server?
Thanks dude.
slypire is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 08-09-2013 , 15:03   Re: some logs for plugin
Reply With Quote #6

of course, but as I said you can find better plugins.
akcaliberg is offline
slypire
Junior Member
Join Date: May 2013
Old 08-09-2013 , 15:07   Re: some logs for plugin
Reply With Quote #7

Thansk a lot, Can I send u PM with one more plugin xp and levels but i need some help for fixing hud, I will send u PM if u are able and if u want to help me, thanks for this one more time.

Moderator, lock please!
slypire is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 08-09-2013 , 15:34   Re: some logs for plugin
Reply With Quote #8

FYI, your "log" is incomplete. If you look at the rest of the log, it would have told you what the problem was
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 00:05.


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