I just started using AMXX and I decided to make a test plugin. Im new to the AMXX natives, so im getting errors. Heres the code:
Code:
/*
* Created by ashade
*
* Commands:
*
* say /checkpoint will save your coordinates (x,y,z) into a 3d array
* say /gocheck will teleport you to your checkpoint
* say /stuck will destuck you if you get stuck due to a checkpoint
* say /god will give you godmode
*
* Information:
*
* I designed this coding for fun use during a kz (<a href="http://www.kreedz.com" target="_blank" rel="nofollow noopener">www.kreedz.com</a>) map.
* The origanol code is from Asskicr for he inspired me to try and make
* this coding. IMPORTANT: IF YOU CHECKPOINT CLOSE TO A WALL YOU MAY GET
* STUCK, HENCE THE /STUCK COMMAND. When you enter godmode will be enabled
* on connect.
*
* Have fun and happy climbing!
*/
///////////////////////
#include <amxmodx>
#include <amxmisc>
///////////////////////
new CheckOrigin[33][3]
new bool:checked[33]
new OldOrigin[33][3]
///////////////////////
public god(id)
{
if(get_cvar_num("sv_kreedz")==0)
{
return PLUGIN_HANDLED
}
if(is_user_alive(id)==1)
{
set_user_godmode(id,1)
client_print(id,print_chat,"[AMXX] Godmode enabled!")
}
}
public check(id)
{
if(get_cvar_num("sv_kreedz")==0)
{
return PLUGIN_HANDLED
}
if(is_user_alive(id)==1)
if(!checked[id])
checked[id] = true
get_user_origin(id, CheckOrigin[id])
client_print(id,print_chat,"[AMXX] Checkpoint saved!")
return PLUGIN_HANDLED
}
public gocheck(id)
{
if(get_cvar_num("sv_kreedz")==0)
{
return PLUGIN_HANDLED
}
if(!checked[id])
{
client_print(id,print_chat,"[AMXX] You must set an origin 1st using say /checkpoint")
return PLUGIN_HANDLED
}
new Origin[3];
get_user_origin(id,Origin);
for(new i=0;i<3;i++)
OldOrigin[id][i] = Origin[i]
set_user_origin(id, CheckOrigin[id])
client_print(id,print_chat,"[AMXX] You have been teleported to your checkpoint")
return PLUGIN_HANDLED
}
public stuck(id)
{
if(get_cvar_num("sv_kreedz")==0)
{
return PLUGIN_HANDLED
}
set_user_origin(id, OldOrigin[id])
client_print(id,print_chat,"[AMXX] You have been teleported to your last checkpoint to be unstuck")
return PLUGIN_HANDLED
}
public plugin_init()
{
register_plugin("kz_allinone","1.0","ashade")
register_cvar("sv_kreedz","1")
register_clcmd("say /god","god",0,": will give someone godmode")
register_clcmd("say /checkpoint","check",0,": Will save users origin")
register_clcmd("say /gocheck","gocheck",0,": will take user to checkpoint")
register_clcmd("say /stuck","stuck",0,": de stuck ya")
return PLUGIN_CONTINUE
}