Raised This Month: $51 Target: $400
 12% 

API Scripting Help Zombie VIP Class


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RBE sLayeR
Member
Join Date: Jul 2019
Location: Republic of Kosovo
Old 04-01-2020 , 14:12   Zombie VIP Class
Reply With Quote #1

Hello there so i tried making this class only for VIPs using some tutorials and got an error

Code:
/*================================================================================
	
	-----------------------------------
	-*- [ZP] Class: Zombie: Classic -*-
	-----------------------------------
	
	This plugin is part of Zombie Plague Mod and is distributed under the
	terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
	
================================================================================*/

#include <amxmodx>
#include <zp50_class_zombie>
#include <zm_vip>

public zp_fw_class_zombie_select_pre(id, classid) {
    if (classid == g_ZombieClassID) {
        if (zv_get_user_flags(id) == 0) {
            zp_class_zombie_menu_text_add("*VIP* only!")
            return ZP_CLASS_NOT_AVAILABLE;
        }
        else {
            zp_class_zombie_menu_text_add("*VIP*")
            return ZP_CLASS_AVAILABLE;
        }
    }
    return ZP_CLASS_AVAILABLE;
} 

// Classic Zombie Attributes
new const zombieclass1_name[] = "Lava Zombie"
new const zombieclass1_info[] = "-[ V.I.P ]-"
new const zombieclass1_models[][] = { "rbe_lava" }
new const zombieclass1_clawmodels[][] = { "models/zombie_plague/v_rbe_lava.mdl" }
const zombieclass1_health = 1800
const Float:zombieclass1_speed = 0.75
const Float:zombieclass1_gravity = 1.0
const Float:zombieclass1_knockback = 1.0

new g_ZombieClassID

public plugin_precache()
{
	register_plugin("[ZP] Class: Zombie: Classic", ZP_VERSION_STRING, "ZP Dev Team")
	
	new index
	
	g_ZombieClassID = zp_class_zombie_register(zombieclass1_name, zombieclass1_info, zombieclass1_health, zombieclass1_speed, zombieclass1_gravity)
	zp_class_zombie_register_kb(g_ZombieClassID, zombieclass1_knockback)
	for (index = 0; index < sizeof zombieclass1_models; index++)
		zp_class_zombie_register_model(g_ZombieClassID, zombieclass1_models[index])
	for (index = 0; index < sizeof zombieclass1_clawmodels; index++)
		zp_class_zombie_register_claw(g_ZombieClassID, zombieclass1_clawmodels[index])
}
And error code is
Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

zp50_class_zombie_lava.sma(17) : error 017: undefined symbol "g_ZombieClassID"

1 Error.
__________________
Copy-and-Paste was programmed by programmers for programmers actually
RBE sLayeR is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-01-2020 , 14:33   Re: Zombie VIP Class
Reply With Quote #2

put public zp_fw_class_zombie_select_pre(id, classid) function under plugin_init() function. You're trying to retrieve a variable that hasn't been declared yet.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
RBE sLayeR
Member
Join Date: Jul 2019
Location: Republic of Kosovo
Old 04-01-2020 , 15:12   Re: Zombie VIP Class
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
put public zp_fw_class_zombie_select_pre(id, classid) function under plugin_init() function. You're trying to retrieve a variable that hasn't been declared yet.
i didnt find any plugin_init
can you do this for me cuz im not a scriptor XD
__________________
Copy-and-Paste was programmed by programmers for programmers actually
RBE sLayeR is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-01-2020 , 15:53   Re: Zombie VIP Class
Reply With Quote #4

try this

PHP Code:
/*================================================================================

-----------------------------------
-*- [ZP] Class: Zombie: Classic -*-
-----------------------------------

This plugin is part of Zombie Plague Mod and is distributed under the
terms of the GNU General Public License. Check ZP_ReadMe.txt for details.

================================================================================*/

#include <amxmodx>
#include <zp50_class_zombie>
#include <zm_vip>

// Classic Zombie Attributes
new const zombieclass1_name[] = "Lava Zombie"
new const zombieclass1_info[] = "-[ V.I.P ]-"
new const zombieclass1_models[][] = { "rbe_lava" }
new const 
zombieclass1_clawmodels[][] = { "models/zombie_plague/v_rbe_lava.mdl" }
const 
zombieclass1_health 1800
const Float:zombieclass1_speed 0.75
const Float:zombieclass1_gravity 1.0
const Float:zombieclass1_knockback 1.0

new g_ZombieClassID

public plugin_precache()
{
    
register_plugin("[ZP] Class: Zombie: Classic"ZP_VERSION_STRING"ZP Dev Team")
    
    new 
index
    
    g_ZombieClassID 
zp_class_zombie_register(zombieclass1_namezombieclass1_infozombieclass1_healthzombieclass1_speedzombieclass1_gravity)
    
zp_class_zombie_register_kb(g_ZombieClassIDzombieclass1_knockback)
    for (
index 0index sizeof zombieclass1_modelsindex++)
        
zp_class_zombie_register_model(g_ZombieClassIDzombieclass1_models[index])
    for (
index 0index sizeof zombieclass1_clawmodelsindex++)
        
zp_class_zombie_register_claw(g_ZombieClassIDzombieclass1_clawmodels[index])
}

public 
zp_fw_class_zombie_select_pre(idclassid) {
    if (
classid == g_ZombieClassID) {
        if (
zv_get_user_flags(id) == 0) {
            
zp_class_zombie_menu_text_add("*VIP* only!")
            return 
ZP_CLASS_NOT_AVAILABLE;
        }
        else {
            
zp_class_zombie_menu_text_add("*VIP*")
            return 
ZP_CLASS_AVAILABLE;
        }
    }
    return 
ZP_CLASS_AVAILABLE;

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
RBE sLayeR
Member
Join Date: Jul 2019
Location: Republic of Kosovo
Old 04-03-2020 , 08:24   Re: Zombie VIP Class
Reply With Quote #5

Plugin now compiled without any error
But the problem is that zombie class is not showing on class menu .. could it be because it has ID 1 same as classic zm
PHP Code:
g_ZombieClassID zp_class_zombie_register(zombieclass1_namezombieclass1_infozombieclass1_healthzombieclass1_speedzombieclass1_gravity)
    
zp_class_zombie_register_kb(g_ZombieClassIDzombieclass1_knockback)
    for (
index 0index sizeof zombieclass1_modelsindex++)
        
zp_class_zombie_register_model(g_ZombieClassIDzombieclass1_models[index])
    for (
index 0index sizeof zombieclass1_clawmodelsindex++)
        
zp_class_zombie_register_claw(g_ZombieClassIDzombieclass1_clawmodels[index])

__________________
Copy-and-Paste was programmed by programmers for programmers actually
RBE sLayeR is offline
MyFavouriteColorIsRain
New Member
Join Date: Nov 2019
Location: Haskovo, Bulgaria
Old 04-06-2020 , 11:03   Re: Zombie VIP Class
Reply With Quote #6

Plugin works perfect and thank you
__________________
MyFavouriteColorIsRain 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 14:49.


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