AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with seermode (https://forums.alliedmods.net/showthread.php?t=25074)

pixel3 03-07-2006 11:11

Help with seermode
 
Hi, I'm working on a plugin.. I think I have it fisihed but It doesnt seem to work. It compiles fine tho... Here is the code:

Code:
#define ADMIN_LEVEL ADMIN_KICK #define TE_BEAMPOINTS 0 new bool:seermode[32] new players[32] new origin1[3] new origin2[3] new num, i new line public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("amx_seer", "handle_seer", ADMIN_LEVEL, "<authid, nick or #userid> <on|off> - set seer mode on player") } public plugin_precache() {     line = precache_model("sprites/dot.spr") } public handle_seer(id, level, cid) {     if (!cmd_access(id,level,cid,3)) {         return PLUGIN_HANDLED     }     new target[24], status[4]     read_argv(1, target, 23)     read_argv(2, status, 4)     new player = cmd_target(id, target, 2)     new name[2][32]     get_user_name(id, name[0], 31)     get_user_name(player, name[1], 31)     if (equal(status, "on")) {         seermode[player] = true         set_task(0.3, "update_seer", player, _, _, "b")         console_print(id, "Seer mode has been enabled on client %s", name[1])         switch(get_cvar_num("amx_show_activity")) {             case 1 : client_print(0,print_chat,"[AMXX] ADMIN: Enable seer mode on player %s",name[1]);             case 2 : client_print(0,print_chat,"[AMXX] ADMIN %S: Enable seer mode on player %s",name[0],name[1]);         }     }     if (equal(status, "off")) {         seermode[player] = false         if (task_exists(player)) {             remove_task(player)         }         console_print(id, "Seer mode has been disabled on client %s", name[1])         switch(get_cvar_num("amx_show_activity")) {             case 1 : client_print(0,print_chat,"[AMXX] ADMIN: Disable seer mode on player %s",name[1]);             case 2 : client_print(0,print_chat,"[AMXX] ADMIN %S: Disable seer mode on player %s",name[0],name[1]);         }     }     return PLUGIN_HANDLED } public update_seer(id) {     if (!is_user_connected(id)) {         return PLUGIN_HANDLED     }     if (!seermode[id]) {         return PLUGIN_HANDLED     }     get_user_origin(id, origin1)     get_players(players, num, "a")     new CsTeams:team = cs_get_user_team(id)     for (i = 0; i <= num; i++) {         get_user_origin(players[i], origin2)         if (!is_user_connected(players[id])) continue         new CsTeams:team2 = cs_get_user_team(players[i])         if (team != team2) {             message_begin(MSG_ONE, SVC_TEMPENTITY, {0,0,0}, id)             write_byte(TE_BEAMPOINTS)             write_coord(origin1[0]) // starting position             write_coord(origin1[1])             write_coord(origin1[2])             write_coord(origin2[0]) // ending position             write_coord(origin2[1])             write_coord(origin2[2])             write_short(line)   // sprite index             write_byte(1)       // starting frame             write_byte(5)       // frame rate             write_byte(5)       // life             write_byte(3)       // line width             write_byte(1)       // noise             switch (team) {                 case CS_TEAM_T: { // terrorists                     write_byte(255) // red                     write_byte(0)   // green                     write_byte(0)   // blue                 }                 case CS_TEAM_CT: { // counter-terrorists                     write_byte(0) // red                     write_byte(0)   // green                     write_byte(255)   // blue                 }             }             write_byte(155)     // brightness             write_byte(5)       // scroll speed             message_end()         }     }     return PLUGIN_HANDLED }

If I use command amx_seer then it tells that Seer mode was enabled on target but no lines are shown. Any idea why? :roll:

Ramono 03-07-2006 12:02

Re: Help with seermode
 
Quote:

Originally Posted by pixel3
If I use command amx_seer then it tells that Seer mode was enabled on target but no lines are shown. Any idea why? :roll:

I'm not shure but dot.spr is not a line
maybe you must use laserbeam.spr

VEN 03-07-2006 12:20

That's for maxplayers <= 31
Code:
new bool:seermode[32] new players[32]

That's for maxplayers <= 32
Code:
new bool:seermode[33] new players[33]

33 because array indexing starts from zero and player indexing from 1

pixel3 03-07-2006 12:37

@Ramono:
I think it should still be dot.spr I looked other plugins while making this and all used dot.spr :shock:

@VEN:
I cant use players[33]? It says that array sizes do not match, or destination array is too small.

pixel3 03-07-2006 13:55

Ok, for some weird reason this plugin seems to work now.... But I have a little issue... I changed set task to 0.1 after that I havent tested this plugin yet. But right now Starting position seems to stay behind a little... Lets say that I walk left, but this line/seer is few inches right from me ... Also I see multiple lines for one person, I dont know why... about 3 lines for one person... I think it is because the first line is not disappearing before others appear .... So.. anybody might wanna help me out here? :roll:

VEN 03-07-2006 14:04

Yes, players[32] is correct, didn't noticed that you used it in get_players

Did yo mean players[i]?
Code:
if (!is_user_connected(players[id])) continue

pixel3 03-07-2006 14:14

Yeah. it should be players[i] instead.. thx :)

pixel3 03-08-2006 10:09

Quote:

Originally Posted by pixel3
Ok, for some weird reason this plugin seems to work now.... But I have a little issue... I changed set task to 0.1 after that I havent tested this plugin yet. But right now Starting position seems to stay behind a little... Lets say that I walk left, but this line/seer is few inches right from me ... Also I see multiple lines for one person, I dont know why... about 3 lines for one person... I think it is because the first line is not disappearing before others appear .... So.. anybody might wanna help me out here? :roll:

Ok, I have tryed different write_byte versions for now and nothing seems to help... I still get multiple lines for one person. Maybe the problem is not in message_begin? Can some other thing cause this?


All times are GMT -4. The time now is 20:24.

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