Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
new g_nMsgScreenFade
new gTrailModel
new uBought[33]
public plugin_init() {
register_plugin("HEAT VISION", "1.0b", "BetaX");
register_clcmd("say /buy", "handle_buy", -1, "This gives the user who invoked the command Heat Vision.");
register_clcmd("+hvision","handle_settask",-1,"This activates the Heat Vision.");
register_clcmd("-hvision","handle_normal",-1,"This turns the heat vision off.");
g_nMsgScreenFade = get_user_msgid("ScreenFade");
}
public plugin_precache() {
gTrailModel = precache_model("sprites/laserbeam.spr");
}
public handle_settask(id) {
set_task(0.1,"handle_green",5,_,_,"b");
return PLUGIN_HANDLED;
}
public handle_buy(id) {
if(is_user_alive(id) == 1) {
new pMoney = cs_get_user_money(id);
if (pMoney <= 100) {
uBought[id] = 0;
return PLUGIN_HANDLED;
} else {
new pNewMoney = pMoney - 100;
cs_set_user_money(id, pNewMoney, 1);
uBought[id] = 1;
return PLUGIN_HANDLED;
}
} else if(is_user_alive(id) == 0) {
uBought[id] = 0;
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED
}
public handle_green(id) {
if(uBought[id] == 1 && is_user_alive(id) == 1) {
// Taken after examining sunglasses by V3x. <3
message_begin(MSG_ONE,g_nMsgScreenFade,{0,0,0},id);
write_short(15);
write_short(15);
write_short(12);
write_byte(0);
write_byte(200);
write_byte(0);
write_byte(50);
message_end();
// Ripped from Predator by Haimmaik. <3
new players[32];
new pnum,origin[3];
new idheat,id;
get_players(players,pnum,"a");
for (new i = 0; i < pnum; ++i);
idheat = players[i];
get_user_origin(idheat,origin,0);
message_begin(MSG_ONE,SVC_TEMPENTITY,origin,id);
write_byte(21);
write_coord(origin[0]);
write_coord(origin[1]);
write_coord(origin[2]);
write_coord(origin[0]);
write_coord(origin[1]);
write_coord(origin[2]+30);
write_short(gTrailModel);
write_byte(0);
write_byte(1);
write_byte(5);
write_byte(40);
write_byte(1);
write_byte(250); // red
write_byte(60); // green
write_byte(0); // blue
write_byte(255); //brightness
write_byte(0);
message_end();
client_print(id,print_chat,"[HV] You have enabled Heat Vision.");
} else if(uBought[id] == 0 || is_user_alive(id) == 0) {
client_print (id,print_chat,"[HV] Error: You are either dead or do not possess Heat Vision.");
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}
public handle_normal(id) {
if(uBought[id] == 1) {
remove_task(5,0);
} else if (uBought[id] == 0) {
client_print(id,print_chat,"[HV] You did not buy Heat Vision. Use /buy to buy Heat Vision.");
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}
For some reason, I'm getting errors on lines 67 and 68. ._.
I screwed up somewhere.