Raised This Month: $ Target: $400
 0% 

some logs for plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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