AlliedModders

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

Nick 12-29-2004 01:24

Plugin Errors
 
I'm making a Hev plugin. I'm trying to make it so you must buy the hev plugin but I'm already have problems. Here is what I have so far.
Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <engine> new bool:is_hev[33] = false public plugin_init() {     register_plugin("Hev Suit","v1.0","Nicholas Glistak")     register_cvar("hev_suit","1")     register_cvar("hev_cost","5000") } public plugin_precache() {     precache_sound("sound/fvox/hev_logon.wav") } public BuyHev(ids[32], player) {     if (get_cvar_num("hev_suit") == 1) {         new buyer = ids[0]         if (is_hev[buyer]) {             new cost = get_cvar_num("hev_cost")             if (cs_get_user_money(buyer) < cost) {                 client_print(buyer, print_chat, "[Hev] You currently need %d to buy a Hev Suit", cost)                 return PLUGIN_HANDLED             } else if (cs_get_user_money(buyer) >= cost) {                 is_hev[buyer] = true                 set_task(0.1, "HevSuit", buyer)                 client_print(buyer, print_chat, "[Hev] You have bought an Hev Suit for $%d", cost)                 cs_set_user_money(buyer, cs_get_user_money(buyer) - cost)                 new r = random(256)                 new g = random(256)                 new b = random(256)                 switch (get_cvar_num("amx_show_activity")) {                     case 2:                     {                         set_hudmessage(r, g, b, 0.03, 0.62, 2, 0.02, 6.0, 0.01, 0.1, 1)                         show_hudmessage(buyer, "[Hev] %s has bought an Hev Suit", buyer)                     }                     case 1:                     {                         for(new i = 0; i < player; i++) {                             if (cs_get_user_team(buyer[i]) == 1) {                                 set_hudmessage(r, g, b, 0.03, 0.62, 2, 0.02, 6.0, 0.01, 0.1, 1)                                 show_hudmessage(buyer, "[Hev] Someone on Terrorists has bought a Hev Suit")                             } else if (cs_get_user_team(buyer[i]) == 2) {                                 set_hudmessage(r, g, b, 0.03, 0.62, 2, 0.02, 6.0, 0.01, 0.1, 1)                                 show_hudmessage(buyer, "[Hev] Someone on Counter Terrorists has bought a Hev Suit")                             }                         } // end for                     } // end case                 } // end switch             } // end else if         } else if (!is_hev[buyer]) {             client_print(buyer, print_chat, "[Hev] You have already bought a Hev Suit")             return PLUGIN_HANDLED         }     } else if (get_cvar_num("hev_suit") != 1) {         client_print(buyer, print_chat, "[Hev] Sorry, buy the Hev Suit plugin is currently turned Off")         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED } public HevSuit(id) {     if (!is_hev[id]) {         client_cmd(id, "spk sound/fvox/hev_logon.wav")         return PLUGIN_HANDLED     } }

XxAvalanchexX 12-29-2004 02:27

Re: Plugin Errors
 
http://forums.joe.to/images/smiles/thanks.gif

Now, do you have a question, or are you just stating that you are making a plugin and you are having problems?

Nick 12-29-2004 02:30

Compiles with errors, also not sure if I am doing it correctly.

Freecode 12-29-2004 02:38

post errors. i already see some modification and some stuff thats missing but thats different from errors. we need errors :)

Nick 12-29-2004 02:57

HEV.sma<20> : warning 219: local variable "buyer" shadows a variable at a proceding level
Line 20:
Code:
new buyer = ids[0]
HEV.sma<43> : error 028: ivalid subscript <not an array or too many subscrips>: "buyer"

HEV.sma<43> : warning 215: expression has no effect
HEV.sma<43> : error 001: expected token: ";", but found "]"
HEV.sma<43> : error 029: invalid expression, assumed zero
HEV.sma<43> : fatal error 107: too many error messages on one line
line 43:
Code:
if (cs_get_user_team(buyer[i]) == 1) {

XxAvalanchexX 12-29-2004 14:43

You declare buyer as an integer, but access it as an array? :?


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

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