Junior Member
|
05-20-2008
, 08:55
Re: [TUT/INFO] set_tasks: when they are and when they aren't necessary
|
#44
|
I read the tutorial, but I couldn't get it to work. Here is the same code with the task thing I tried.
Code:
#include <amxmodx>
#include <amxmisc>
#include <tsx>
#include <tsxaddon>
#include <dbi>
#include <engine>
#include <engine_stocks>
#include <fun>
#include <fakemeta>
#include <tsfun>
#include <harbu>
#include <ava_ts>
#define spawn_cooldown 120.0
new Float:g_Lastspawn[33]
new Float:g_Cooldown = spawn_cooldown
public plugin_init
{
register_plugin(PLUGIN, AUTHOR, VERSION)
//all say commands
register_clcmd( "say","say_handle")
}
public say_handle(id)
{
new buffer[256], buffer1[33], buffer2[33], buffer3[33], origin[3]
get_user_origin(id,origin)
read_argv(1,buffer,255)
parse(buffer, buffer1, 32, buffer2, 32, buffer3, 32)
if(equali(buffer1,"/glock18") || equali(buffer1,"/glock 18"))
{
new Float:Time
global_get(glb_time,Time)
if(!is_user_alive(id) || Time - g_Cooldown < g_Lastspawn[id])
return
g_LastAttack[id] = Time
ts_giveweapon(id, 1, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Glock18")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/uzi"))
{
ts_giveweapon(id, 3, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Mini-Uzi")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/benelli"))
{
ts_giveweapon(id, 4, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Benelli m3")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/m4a1"))
{
ts_giveweapon(id, 5, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned M4A1")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/mp5sd"))
{
ts_giveweapon(id, 6, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned MP5SD")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/mp5k"))
{
ts_giveweapon(id, 7, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned MP5K")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/beretta"))
{
ts_giveweapon(id, 8, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Beretta")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/socom"))
{
ts_giveweapon(id, 9, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Socom MK23")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/usas"))
{
ts_giveweapon(id, 11, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Usas 12")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/deagle"))
{
ts_giveweapon(id, 12, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Desert Eagle")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/ak47"))
{
ts_giveweapon(id, 13, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned AK-47")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/aug") || equali(buffer1,"/steyraug"))
{
ts_giveweapon(id, 15, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Steyr Aug")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/fiveseven"))
{
ts_giveweapon(id, 14, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Five/Seven")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/scorpion"))
{
ts_giveweapon(id, 17, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Scorpion")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/barret"))
{
if( get_cvar_num("disable_barret") > 0 )
{
client_print(id,print_chat,"[Zombiemod]Barret is not allowed")
}
else
{
ts_giveweapon(id, 18, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Barret")
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
if(equali(buffer1,"/pdw") || equali(buffer1,"/mp7"))
{
ts_giveweapon(id, 19, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned HK PDW")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/spas"))
{
ts_giveweapon(id, 20, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Spas 12")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/colts"))
{
ts_giveweapon(id, 21, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Golden Colts")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/glock20"))
{
ts_giveweapon(id, 22, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Glock 20 C")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/ump"))
{
ts_giveweapon(id, 23, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned UMP")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/cknife"))
{
if( get_cvar_num("disable_blades") > 0 )
{
client_print(id,print_chat,"[Zombiemod]Blades are not allowed")
}
else
{
ts_giveweapon(id, 25, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Combat Knife")
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
if(equali(buffer1,"/mossberg"))
{
ts_giveweapon(id, 26, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Mossberg 500")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/m16"))
{
ts_giveweapon(id, 27, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned M16A4")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/ruger"))
{
ts_giveweapon(id, 28, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Ruger MK1")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/rbull") || equali(buffer1,"/ragingbull"))
{
ts_giveweapon(id, 31, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Raging Bull")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/m60"))
{
if( get_cvar_num("disable_m60") > 0 )
{
client_print(id,print_chat,"[Zombiemod]M60 is not allowed")
}
else
{
ts_giveweapon(id, 32, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned M60")
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
if(equali(buffer1,"/sawnoff"))
{
ts_giveweapon(id, 33, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Sawed off shotgun")
return PLUGIN_HANDLED
}
if(equali(buffer1,"/katana"))
{
if( get_cvar_num("disable_blades") > 0 )
{
client_print(id,print_chat,"[Zombiemod]Blades are not allowed")
}
else
{
ts_giveweapon(id, 34, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Katana")
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
if(equali(buffer1,"/sknife"))
{
if( get_cvar_num("disable_blades") > 0 )
{
client_print(id,print_chat,"[Zombiemod]Blades are not allowed")
}
else
{
ts_giveweapon(id, 35, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Seal Knife")
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
if(equali(buffer1,"/contender"))
{
if( get_cvar_num("disable_contender") > 0 )
{
client_print(id,print_chat,"[Zombiemod]Contender is not allowed")
}
else
{
ts_giveweapon(id, 36, 255, 14)
client_print(id,print_chat,"[Zombiemod]You spawned Contender G2")
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
This gives me a error of using the return and return <value>. I tried
to remove return PLUGIN_HANDLED but it didnt work. then all commands execpt the
/glock18 spawn the glock18. I tried to remove the return, but it didnt work either.
Iam not very good at coding (actually iam not good at all) and
I really cant understand this tutorial better since english is not
my native language. Please help
__________________
+ karma if helpful
Last edited by Tomppaduulis; 05-21-2008 at 10:41.
|
|