Raised This Month: $ Target: $400
 0% 

No errors or warnings, yet it doesnt work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-15-2010 , 10:43   Re: No errors or warnings, yet it doesnt work
Reply With Quote #1

PHP Code:
#include <amxconst> 
is not needed, it is automaticly included with <amxmodx>

PHP Code:
Params[0] = get_cvar_num("amx_NadeSpawn_Time")    //Param[0] = Spawn time for a nade
    
Params[1] = get_cvar_num("amx_NadeSpawn_Type")    //Param[1] = Type of nade (1 = He | 2 = Flash | 3 = Smoke) 
You should use pcvars, because they are faster. Like this:
PHP Code:
new cvar_typecvar_time

public plugin_init() {
    new 
NadeSpawnOn 1    //used by Toogle
    
register_plugin(PLUGINVERSIONAUTHOR)    
    
register_clcmd("amx_NadeSpawn_Toogle""Toogle"//Toogle's NadeSpawn on and off
    
cvar_type register_cvar("amx_NadeSpawn_Type""1")    //which type of grenade
    
cvar_time register_cvar("amx_NadeSpawn_Time""5")    //Time in sec before grenade spawns
    
register_clcmd("amx_NadeSpawn_Help""Help")    //Displays some help in the console
    
    //Define Parameters for SpawnNade loop:
    
new Params[2]
    
Params[0] = get_pcvar_num(cvar_time)    //Param[0] = Spawn time for a nade
    
Params[1] = get_pcvar_num(cvar_type)    //Param[1] = Type of nade (1 = He | 2 = Flash | 3 = Smoke) 
Use a switch here:
PHP Code:
public PreSpawnNade(SpawnTimenumNadeTypeid) {
    
//check what nade we are spawning..
    
if (numNadeType == 1) {
        
set_task(float(SpawnTime), "SpawnHE")
    }
    if (
numNadeType == 2) {
        
set_task(float(SpawnTime), "SpawnFlash")
    }
    if (
numNadeType == 3) {
        
set_task(float(SpawnTime), "SpawnSmoke")
    }


PHP Code:
public PreSpawnNade(SpawnTimenumNadeTypeid) {
    
//check what nade we are spawning..
    
switch(numNadeType)
    {
        case 
1:
            
set_task(float(SpawnTime), "SpawnHE")
        case 
2:
            
set_task(float(SpawnTime), "SpawnFlash")
        
        case 
3:
            
set_task(float(SpawnTime), "SpawnSmoke")
    }

instead of setting bpammo, use give_item from
PHP Code:
 #include <fun>

give_item(id"weapon_hegrenade"
and it doesn't work because you use id in preSpawnNade, but you don't got id there. I recommend using hamsandwich to detecht player spawn, and call that function there.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.

Last edited by drekes; 06-15-2010 at 14:45.
drekes is offline
Send a message via MSN to drekes
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:48.


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