AlliedModders

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

Dizzy 09-09-2004 23:27

Errors With My Plugin
 
I have my plugin which is

Code:
//--------------------------------------------------------------------------------------------------------------------------- /*UnStick : For KZ Maps * By Dizzy * * * * CVARS unstick * 0/1 * * Client Commands * /unstick * * * Description: * Puts No Clip On Client For 2 Seconds For The Client To Get Out of being stuck in * a checkpoint Teleport * * * Made For KZ Maps * * */ //--------------------------------------------------------------------------------------------------------------------------- #include <amxmodx> #include <fun> #include <engine> //--------------------------------------------------------------------------------------------------------------------------- new bool:isusingunstick = false new bool:canuseunstick = true //--------------------------------------------------------------------------------------------------------------------------- public plugin_init() {     register_plugin("UnStick","1.0","Dizzy")     register_cvar("unstick","1")     register_cvar("unstick_cooldown","60")     register_cvar("unstick_cliptime","2")     register_clcmd("/unstick","unstick")     register_event("ResetHUD","reset","b") } //--------------------------------------------------------------------------------------------------------------------------- public client_connect(id) {     isusingunstick = false     canuseunstick = true } public reset(id) {     canuseunstick = true     isusingunstick = false //--------------------------------------------------------------------------------------------------------------------------- public unstick(id) {     if(!canuseunstick) {     client_print(id, print_chat,"Sorry, you have just recently used unstick please wait until you can again")     }     if(canuseunstick) {     set_user_noclip(id, 1)     set_task(get_cvar_float("unstick_cliptime"),"disable")     }     return PLUGIN_CONTINUE } //--------------------------------------------------------------------------------------------------------------------------- public disable(id) {     set_user_noclip(id)     canuseunstick = false     set_task(get_cvar_float("unstick_cooldown"),"reenable") } public reenable(id) {     canuseunstick = true }

What it does is it give someone no clip for 2 seconds to get out of an area if there stuck like in a false kz_teleport.
You can use it once every 60 seconds!

And I get errors!

here they are

unstick.sma<54> : warning 217: loose indentation
unstick.sma<54> : error 029: incalid expression, assumed zero
unstick.sma<54> : error 017: undefined symbol "unstick"
unstick.sma<66> : error 017: undefined symbol "disable"
unstick.sma<71> : error 029: invalid expression, assumed zero
unstick.sma<71> : error 017: undefined symbol "reenable"
unstick.sma<73> : error 001: expected token: ">", but found "-end of file-"


Can anyone do this / help?! Thanks Please Re-post!

Votorx 09-10-2004 08:11

Dude...why don't you take a look at your brackets...

*hint hint* the reset function...

Freecode 09-10-2004 08:13

Code:
public reset(id) {     canuseunstick = true     isusingunstick = false

missing brackets.
also these should be arrays
Code:
new bool:isusingunstick = false new bool:canuseunstick = true

Dizzy 09-10-2004 16:41

Arrays??? What's that?

Freecode 09-10-2004 16:45

stuff inside these boxes
[]
example
Code:
new example[32]; // This is an array // Your suppose to look like new bool:isusingunstick[32] = false new bool:canuseunstick[32] = true

If you dont noe how to use array then leanr cuz ur plugin is buggy without them

Anpheus 09-10-2004 18:21

See, if you want to keep track of each player, you're going to want 32 'isusingunstick' and 'canuseunstick' variables.

But it's much easier to do isusingunstick[Player #] than isusingunstick1 isusingunstick2 etc.

Votorx 09-10-2004 18:50

Eh I didn't know you need to make bools an array.

johnjg75 09-10-2004 18:51

me either :|

Anpheus 09-10-2004 18:56

You dont.

*sighs*

Listen, you have thirty-two players

the variable, isusingunstick has only two values. "True" and "False"

So, who is using unstick? You cannot tell. It can only be True or False, it cannot be '32 is True' or '1 is False'.


So when you want to figure out whether a player number n is using unstick, how do you do it?

What if TWO players use unstick at the same time?! You cannot give a single boolean 64 possible values. The most efficient method is bitwise manipulation, in which you could store 32 booleans in a single integer, but that is clearly not the case! Let's think logically.

If two players use it at the same time, you have the same boolean value applying to both players, regardless of whether it is true or not!

Let's think logically!

Dizzy 09-10-2004 19:37

Ehhhh

Arrays Make more errors well, Here is my script

Code:
#include <amxmodx> #include <fun> #include <engine> new bool:isusingunstick = false new bool:canuseunstick = true public plugin_init() {     register_plugin("UnStick","1.0","Dizzy")     register_cvar("unstick","1")     register_cvar("unstick_cooldown","60")     register_cvar("unstick_cliptime","2")     register_clcmd("/unstick","unstick")     register_event("ResetHUD","reset","b") } public client_connect(id) {     isusingunstick = false     canuseunstick = true } public reset(id) {     canuseunstick = true     isusingunstick = false } public unstick(id) {     if(!canuseunstick)     client_print(id, print_chat,"Sorry, you have just recently used unstick please wait until you can again")     }     if(canuseunstick) {     set_user_noclip(id, 1)     set_task(get_cvar_float("unstick_cliptime"),"disable")     return PLUGIN_CONTINUE     } } public disable(id) {     set_user_noclip(id)     canuseunstick = false     set_task(get_cvar_float("unstick_cooldown"),"reenable") } public reenable(id) {     canuseunstick = true }

INvaild Function or Declaration on both

Line 34 and 31

Fix it? :P


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

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