AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Auto Respawn ZP (https://forums.alliedmods.net/showthread.php?t=233403)

myusername 01-14-2014 11:59

Auto Respawn ZP
 
Need help with this code
PHP Code:

#include <amxmodx> 
#include <hamsandwich> 
#include <zp50_core> 
#include <zp50_gamemodes> 

#define TASK_AUTORESPAWN  100 
#define ID_AUTORESPAWN (taskid - TASK_AUTORESPAWN) 

const Float:AUTORESPAWN_DELAY 3.0 

new _gGameModeNemesisID
    
,_gGameModeSurvivorID
    
,_gGameModeMultiID
    
,_gGameModeInfectionID
    
new _pCvarDeathMatch
new _gMaxPlayers 

public plugin_init() {
    
register_clcmd("joinclass","cmd_joinclass"
     
    
register_menucmd(register_menuid("Terrorist_Select",1),511,"cmd_joinclass"
    
register_menucmd(register_menuid("CT_Select",1),511,"cmd_joinclass"
     
    
_pCvarDeathMatch get_cvar_pointer("zp_deathmatch"
     
    
_gMaxPlayers get_maxplayers() 


public 
plugin_cfg()  { 
    
_gGameModeNemesisID zp_gamemodes_get_id("Nemesis Mode"
    
_gGameModeSurvivorID zp_gamemodes_get_id("Survivor Mode"
    
_gGameModeMultiID zp_gamemodes_get_id("Multiple Infection Mode")
    
_gGameModeInfectionID zp_gamemodes_get_id("Infection Mode")


public 
cmd_joinclass(id)  { 
         if(
zp_gamemodes_get_current() == _gGameModeInfectionID || zp_gamemodes_get_current() == _gGameModeMultiID) {
                  
set_task(AUTORESPAWN_DELAY"auto_respawn_player"id+TASK_AUTORESPAWN
    }


public 
auto_respawn_player(taskid)   { 
    if (
is_user_alive(ID_AUTORESPAWN)) 
        return; 
     
    if( 
zp_gamemodes_get_current() == _gGameModeSurvivorID )  { 
        
zp_core_respawn_as_zombie(ID_AUTORESPAWNtrue
        
    }  
    
    else if( 
zp_gamemodes_get_current() == _gGameModeNemesisID )  { 
        
zp_core_respawn_as_zombie(ID_AUTORESPAWNfalse
    } 
    
    else if (
get_pcvar_num(_pCvarDeathMatch) == || (get_pcvar_num(_pCvarDeathMatch) == && random_num(01)) || (get_pcvar_num(_pCvarDeathMatch) == && zp_core_get_zombie_count() < fnGetAlive()/2))  { 
                
zp_core_respawn_as_zombie(ID_AUTORESPAWNtrue
    }  
    
    else  { 
        
zp_core_respawn_as_zombie(ID_AUTORESPAWNfalse
    } 
    
    
ExecuteHamB(Ham_CS_RoundRespawnID_AUTORESPAWN


fnGetAlive() { 
    new 
iAliveid 
     
    
for (id 1id <= _gMaxPlayersid++) { 
        if (
is_user_alive(id)) 
            
iAlive++ 
    } 
    return 
iAlive


Gives me this error
PHP Code:

L 01/14/2014 15:37:02: [AMXXInvalid Player (11)
L 01/14/2014 15:37:02: [AMXXDisplaying debug trace (plugin "AutoRespawn.amxx")
L 01/14/2014 15:37:02: [AMXXRun time error 10native error (native "zp_core_respawn_as_zombie")
L 01/14/2014 15:37:02: [AMXX]    [0AutoRespawn.sma::auto_respawn_player (line 57

Im using zp5.0.8. And also i don't use zp4.3 compat.


Thanks.


All times are GMT -4. The time now is 10:14.

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