AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Socom Plugin Help Needed (https://forums.alliedmods.net/showthread.php?t=5844)

WDUK 09-14-2004 16:17

Socom Plugin Help Needed
 
I am writing a plugin which was suggested in the requests forum, now I am unable to test it beacuse me server is playing up:
Code:
// Socom Gameplay // Adds a bit of realism // // Socom Gameplay: // 1. CTs can pick up the bomb // 2. Ts can make hostages follow them // // Commands: // // amx_socom <0/1> - Turns Socom Mode Off/On // // Created by WDUK // Idea by Mrshiftyswitchblade // // CStrike Module Needed // Engine Module Needed // FakeMeta Module Needed (AMXx 0.20 RC5 Needed) #include <amxmodx> #include <amxmisc> #include <engine> #include <fakemeta> #include <cstrike> #include <csstats> #include <string> #include <fun> #include <FakeFull> #define MINHOSSIEDISTANCE 80.0 new g_buttons[33] new g_buttonsPrevious new i new temp[20] new bombgone public plugin_init() {     register_plugin("Socom Mode","0.01b","WDUK")     register_cvar("amx_socom","0")     register_forward(FM_PlayerPreThink, "forward_playerprethink")     register_message(get_user_msgid("HudTextArgs"), "hook_hudtext")     register_event("BombDrop", "BombDrop", "b")     register_event("SendAudio", "cleanup", "a", "2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")     for(i = 0; i < 33; i++) {         bombgone = false     }     return PLUGIN_CONTINUE } public plugin_precache() {     //precache_model( "models/hostage.mdl")      precache_sound( "sound/misc/kitrustle.wav") } // T use hostage section thanks to JGHG stock userviewhitpoint(index, Float:hitorigin[3]) {     if (!is_valid_ent(index) || index < 1 || index > get_maxplayers()) {         // Error         log_amx("ERROR in plugin - %d is not a valid player index", index)         return 0     }     new Float:origin[3], Float:pos[3], Float:v_angle[3], Float:vec[3], Float:f_dest[3]     entity_get_vector(index, EV_VEC_origin, origin)     entity_get_vector(index, EV_VEC_view_ofs, pos)     pos[0] += origin[0]     pos[1] += origin[1]     pos[2] += origin[2]     entity_get_vector(index, EV_VEC_v_angle, v_angle)     engfunc(EngFunc_AngleVectors, v_angle, vec, 0, 0)     f_dest[0] = pos[0] + vec[0] * 9999     f_dest[1] = pos[1] + vec[1] * 9999     f_dest[2] = pos[2] + vec[2] * 9999     return trace_line(index, pos, f_dest, hitorigin) } public forward_playerprethink(id) {     if (get_cvar_num("amx_socom") != 1)     return PLUGIN_CONTINUE         if (cs_get_user_team(id) != CS_TEAM_T)         return FMRES_IGNORED     g_buttonsPrevious = g_buttons[id]     g_buttons[id] = entity_get_int(id, EV_INT_button)     if (g_buttons[id] & IN_USE && !(g_buttonsPrevious & IN_USE)) {         new Float:fl_hitorigin[3]         new hitent = userviewhitpoint(id, fl_hitorigin)         if (hitent != 0) {             new classname[15]             entity_get_string(hitent, EV_SZ_classname, classname, 14)             if (equal(classname, "hostage_entity")) {                 new Float:hossieOrigin[3], Float:origin[3]                 entity_get_vector(id, EV_VEC_origin, origin)                 entity_get_vector(hitent, EV_VEC_origin, hossieOrigin)                 if (vector_distance(hossieOrigin, origin) <= MINHOSSIEDISTANCE) {                     if (cs_get_hostage_foll(hitent) != id)                         cs_set_hostage_foll(hitent, id)                     else                         cs_set_hostage_foll(hitent, 0)                 }             }         }     }     return FMRES_IGNORED } public hook_hudtext() {     if (get_cvar_num("amx_socom") != 1)     return PLUGIN_CONTINUE         if (get_msg_args() < 1 || get_msg_argtype(1) != ARG_STRING)         return PLUGIN_CONTINUE     new buffer[128]     get_msg_arg_string(1, buffer, 127)     if (equal(buffer, "#Only_CT_Can_Move_Hostages")) // supercede this message         return PLUGIN_HANDLED     return PLUGIN_CONTINUE } // End T use hostage section // CT pick up bomb section thanks to [FBX]     public BombDrop(id) {     if(is_user_alive(id)) {          message_begin( MSG_ONE, 108, {0,0,0}, id )          write_byte(0 )   // duration         write_byte( 0 )                 // duration         message_end()     } } public makesound(arg[]) {     if(is_user_alive(arg[0]) && cs_get_user_bpammo(arg[0], 6) > 0 && attempt[arg[0]] == arg[1]) {         emit_sound(arg[0], CHAN_VOICE, "sound/misc/kitrustle.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)         set_task(float(random_num(6, 14)), "makesound", 44, arg, 2, "")     } } public bombback() {     bombgone = false } public ctsbomb(arg[]) {     new ptd = arg[0]     //server_print("bomb destroyed!!!!")     if(arg[1] == attempt[ptd]) {         //server_print("1!!!!")         new amount = cs_get_user_bpammo(ptd, 6)         //server_print("%i", amount)         if(amount > 0) {             //server_print("2!!!!")             client_print(ptd, print_chat, "You have disabled the bomb!")             moneys[ptd] += 300             cs_set_user_money(ptd, moneys[ptd], 1)             new myname[30]             get_user_name(ptd,myname, 30)             for(new j = 0; j < 33; j++) {                 if(is_user_connected(j)) {                     client_print(j, print_chat, "%s has disabled the bomb!", myname)                     //client_print(j, print_chat, "The Ts will lose if any one of them die now!")                 }             }             //server_print("3!!!!")             engclient_cmd(ptd,"drop", "weapon_c4")             bombgone = true             set_task(4.0, "bombback", 83, "", 0, "")             //set_task(1.0, "undoitall", 58, args, 33, "")             //new players[32]                                     for(new i = 0; i < 33; ++i) {                 if(is_user_alive(i) && cs_get_user_team(i) == 1) {                     cs_set_user_team(i, 3)                     switched[i] = true                     //server_print("%i is T.", i)                 }             }             //server_print("4!!!!")             new idx= FF_MakeClient("Nobody interesting")             cs_set_user_team(idx, 1)             spawn(idx)             user_silentkill(idx)             server_cmd("kick #%d ", get_user_userid(idx)  )             /*new k             for( k = 0; k < 33; ++k) {                 if(is_user_connected(k) && !is_user_alive(k)) {                     spawn(k)                     user_silentkill(k)                     k = 99                 }             }             if(k == 33) {                 for(new j = 0; j < 33; j++) {                     if(is_user_connected(j)) {                         client_print(j, print_chat, "The Terrorists have been executed for giving the CTs the bomb!")                     }                     if(is_user_alive(j) && cs_get_user_team(j) == 3) {                         user_kill(j, 1)                     }                 }             }*/             //set_task(1.0, "undoitall", 58, args, 33, "")         }     } } public pfn_touch(ptr, ptd) {     if(get_cvar_num( "amx_socom" ) != 1)         return PLUGIN_CONTINUE     //server_print("something was touched")     //if(is_user_alive(ptr)) {     //  client_print(ptr, print_chat, "You are ptr")             new targetvector[3]     entity_get_vector(ptr, EV_VEC_velocity, targetvector )     if(is_user_alive(ptd) && targetvector[2] == 0 &&  cs_get_user_team(ptd) == 2) {         //new weap, ammo, clip         //weap = get_user_weapon(ptd, clip, ammo)         //client_print(ptd, print_chat, "%i", weap)         //new iKey         new szreturn[40]         //new tmp[20]         //new temp[3]         //new ret         entity_get_string(ptr,EV_SZ_model ,szreturn, 40)         //client_print(ptd, print_chat, szreturn)         /*for(new i = 20; i < 30; i++) {         //  entity_get_vector(ptr, i ,temp, 40)             ret = entity_get_int(ptr, i)             client_print(ptd, print_chat, "%i", ret)         }         client_print(ptd, print_chat, "-----")*/         //entity_get_string(ptr,         //entity_get_string(ptr, 0, szreturn, 20)         //if(!equal(szreturn, lastname)) {         //client_print(ptd, print_chat, tmp)                 //}         //client_print(ptd, print_chat, "You are ptd")         //client_print(ptd, print_chat, "%f %f %f", temp[0], temp[1], temp[2])         //client_print(ptd, print_chat, "---------------")         //}*/         //entity_get_string(ptr, EV_SZ_model, temp, 20)         //client_print(ptd, print_chat, "%i %s", entity_get_edict(ptr, EV_ENT_owner), temp)         //client_print(ptd, print_chat, "---------------")         //}         //copy(lastname, 20, szreturn)         //client_print(ptd, print_chat, "%i", ret)         if(equal(szreturn, "models/w_backpack.mdl")) {             remove_entity(ptr)             if(!bombgone) {                 give_item(ptd, "weapon_c4")                 cs_set_user_bpammo(ptd, 6, 1)                 attempt[ptd]++                 if(attempt[ptd] > 999)                     attempt[ptd] = 0                 //from amxx proximity mines, modified                  new timer = get_cvar_num( "mp_c4timer" )                 cs_set_user_plant(ptd, 1,1);                     // Progress Bar (Activate)                  message_begin( MSG_ONE, 108, {0,0,0}, ptd )                  write_byte( timer )   // duration                     write_byte( 0 )                 // duration                     message_end()                 new arg[2]                     arg[0] = ptd                 arg[1] = attempt[ptd]                     set_task(float(timer), "ctsbomb", 99 , arg,2, "" )                 makesound(arg)             }         }     }     return PLUGIN_CONTINUE } // End CT pick up bomb section
I then get these compile errors:
Code:

//// amx_socom.sma
// C:\Program Files\Valve\Steam\SteamApps\waveydaveyuk\counter-strike\cstrike\ad
dons\amxmodx\scripting\amx_socom.sma(143) : warning 217: loose indentation
// C:\Program Files\Valve\Steam\SteamApps\waveydaveyuk\counter-strike\cstrike\ad
dons\amxmodx\scripting\amx_socom.sma(148) : error 017: undefined symbol "attempt
"
// C:\Program Files\Valve\Steam\SteamApps\waveydaveyuk\counter-strike\cstrike\ad
dons\amxmodx\scripting\amx_socom.sma(148) : warning 215: expression has no effec
t
// C:\Program Files\Valve\Steam\SteamApps\waveydaveyuk\counter-strike\cstrike\ad
dons\amxmodx\scripting\amx_socom.sma(148) : error 001: expected token: ";", but
found "]"
// C:\Program Files\Valve\Steam\SteamApps\waveydaveyuk\counter-strike\cstrike\ad
dons\amxmodx\scripting\amx_socom.sma(148) : error 029: invalid expression, assum
ed zero
// C:\Program Files\Valve\Steam\SteamApps\waveydaveyuk\counter-strike\cstrike\ad
dons\amxmodx\scripting\amx_socom.sma(148) : fatal error 107: too many error mess
ages on one line
//
// Compilation aborted.
// 4 Errors.
// Could not locate output file compiled\amx_socom.amx (compile failed).
//
// Compilation Time: 0.14 sec
// ----------------------------------------

Now i'm new at this so:
1. Will it work?
2. How do you fix these errors

I have tried and tried but to no avail

Da Bishop 09-14-2004 16:25

well let me take a good look at it and i will get back to u :)

ps:mind giving me fakefull?

WDUK 09-14-2004 17:27

1 Attachment(s)
There you go

Freecode 09-14-2004 17:40

WDUK you dont need to use fakefull module anymore. its very buggy. just use the plugin http://forums.alliedmods.net/showthread.php?t=5761

Da Bishop 09-14-2004 17:42

ill do it thru freecodes way :wink:

EDIT: would do it thru freecodes way but WDUK has this all wire thru the module

Da Bishop 09-14-2004 18:00

attempt[ptd] is this line coming from the fakefull module?

WDUK 09-15-2004 13:08

tbh I dnt know why the fakefull module is there :?

Da Bishop 09-15-2004 15:01

okay but where is this attempt[ptd] comign from?

WDUK 09-15-2004 15:35

I dunno, I got part of the code (which this part is) from another plugin

Da Bishop 09-15-2004 17:28

well then u need to get the other plugin... that string must be defined in it somewhere, so i have no idea what the atttemp[ptd] is meant for


All times are GMT -4. The time now is 17:11.

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