AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   15 new errors... (https://forums.alliedmods.net/showthread.php?t=22893)

Venomxtinct 01-06-2006 11:22

15 new errors...
 
1 Attachment(s)
ok, a little bit ago i put something in my code, trying to get it to work, but it created 15 different errors... now a few days later, I forgot what I put it that made the errors so I cant change it :(

Code:
/home/users/amxmodx/tmp3/phpcYSC9V.sma(18) : error 001: expected token: ";", but found "{" /home/users/amxmodx/tmp3/phpcYSC9V.sma(19) : error 010: invalid function or declaration /home/users/amxmodx/tmp3/phpcYSC9V.sma(22) : error 010: invalid function or declaration /home/users/amxmodx/tmp3/phpcYSC9V.sma(28) : error 001: expected token: "(", but found "-identifier-" /home/users/amxmodx/tmp3/phpcYSC9V.sma(30) : warning 202: number of arguments does not match definition /home/users/amxmodx/tmp3/phpcYSC9V.sma(30) : warning 202: number of arguments does not match definition /home/users/amxmodx/tmp3/phpcYSC9V.sma(30) : error 001: expected token: ";", but found "-identifier-" /home/users/amxmodx/tmp3/phpcYSC9V.sma(30 -- 31) : warning 202: number of arguments does not match definition /home/users/amxmodx/tmp3/phpcYSC9V.sma(30 -- 31) : warning 202: number of arguments does not match definition /home/users/amxmodx/tmp3/phpcYSC9V.sma(33) : error 021: symbol already defined: "cs_get_weapon_id" /home/users/amxmodx/tmp3/phpcYSC9V.sma(34) : error 010: invalid function or declaration /home/users/amxmodx/tmp3/phpcYSC9V.sma(37) : error 010: invalid function or declaration /home/users/amxmodx/tmp3/phpcYSC9V.sma(42) : error 021: symbol already defined: "event_fire" /home/users/amxmodx/tmp3/phpcYSC9V.sma(43) : error 010: invalid function or declaration /home/users/amxmodx/tmp3/phpcYSC9V.sma(45) : error 010: invalid function or declaration /home/users/amxmodx/tmp3/phpcYSC9V.sma(48) : error 001: expected token: ";", but found "{" /home/users/amxmodx/tmp3/phpcYSC9V.sma(49) : error 010: invalid function or declaration /home/users/amxmodx/tmp3/phpcYSC9V.sma(54) : error 021: symbol already defined: "not_drop" /home/users/amxmodx/tmp3/phpcYSC9V.sma(55) : error 010: invalid function or declaration /home/users/amxmodx/tmp3/phpcYSC9V.sma(60) : error 021: symbol already defined: "get_user_health" /home/users/amxmodx/tmp3/phpcYSC9V.sma(61) : error 010: invalid function or declaration /home/users/amxmodx/tmp3/phpcYSC9V.sma(70) : error 001: expected token: ";", but found "{" /home/users/amxmodx/tmp3/phpcYSC9V.sma(71) : error 010: invalid function or declaration /home/users/amxmodx/tmp3/phpcYSC9V.sma(80) : error 021: symbol already defined: "say_after" /home/users/amxmodx/tmp3/phpcYSC9V.sma(81) : error 010: invalid function or declaration /home/users/amxmodx/tmp3/phpcYSC9V.sma(91) : error 017: undefined symbol "cs_roundstart" /home/users/amxmodx/tmp3/phpcYSC9V.sma(94) : error 035: argument type mismatch (argument 1) /home/users/amxmodx/tmp3/phpcYSC9V.sma(95) : error 035: argument type mismatch (argument 1) /home/users/amxmodx/tmp3/phpcYSC9V.sma(97) : warning 203: symbol is never used: "g_awpslapper" /home/users/amxmodx/tmp3/phpcYSC9V.sma(97) : warning 203: symbol is never used: "not_drop" /home/users/amxmodx/tmp3/phpcYSC9V.sma(97) : warning 203: symbol is never used: "say_after" /home/users/amxmodx/tmp3/phpcYSC9V.sma(97) : warning 203: symbol is never used: "user_weapon"

ill attack the code...

Hawk552 01-06-2006 12:10

This is crappiest coding I have ever seen in my entire time here.

I have absolutely no clue what you're trying to do, but here's my best interpretation of it:

Code:
#define PLUGIN "APW/AUTO SLAPPER" #define VERSION "1.0" #define AUTHOR "nAcHo cHeEsE aka Venomxtinct" #define ADMINLEVELNEEDED #include <amxmodx> #include <cstrike> #include <engine> public plugin_init() {     register_plugin(PLUGIN,VERSION,AUTHOR);         register_cvar("amx_awpslap","1")         register_event("CurWeapon","user_weapon","b");     register_event("AmmoX","event_fire","b"); } public user_weapon(id) {     new clip,ammo,weap = get_user_weapon(id,clip,ammo);     new name[32];     get_user_name(id,name,31);     if(weap == CSW_AWP && get_cvar_num("amx_awpslap"))     {         client_print(0,print_chat,"%s has an AWP, watch out!",name)     }     //else     //{         // Pretty retarded, it'll print every time someone changes weaps,         // also if you hook it to round start, if someone buys an awp         // it won't notice.         //client_print("Nobody has an awp, no worries this round!")     //}   }   public event_fire(id) {     new clip,ammo,weap = get_user_weapon(id,clip,ammo);     if(weap == CSW_AWP || CSW_SG550)     {         user_slap(id,20,1);     } }

Hawk552 01-06-2006 12:23

Here's what's wrong with this script:

Code:
#define PLUGIN "APW/AUTO SLAPPER" #define VERSION "1.0" #define AUTHOR "nAcHo cHeEsE aka Venomxtinct" // alright, so you stated, these, but nothing is registering them. #define ADMINLEVELNEEDED // ok, you stated that this exists, but what's the definition? #include <amxmodx> #include <cstrike> #include <engine> new bool:g_awpslapper = false // you never change this or use it, so it's useless public init() { // it's plugin_init     register_cvar("amx_awpslap","1",FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY) // alright, but why all the extras? this won't work in mulitplayer because of the last } public user_weapon { // you pass no parameters (id) into this, and also nothing calls it     if user_has_weapon(id, weapon, CSW_AWP ) // you invented "user_has_weapon", and the func doesn't even work     { // bracket is out of place, end it before else     client_print("SOMEBODY HAS AN AWP, WATCH OUT!") // you don't specify who to print it to, or where to print it     else         client_print("Nobody has an awp, no worries this round!") // you don't specify who to print it to, or where to print it         }  // bracket out of place, open it after else, also, terrible indentation } public event_fire(id) { // nothing calls this     if client_fire(CSW_AWP,"awpslap") // wrap brackets around the condition, and also "client_fire" is not a function     {         user_slap; user_slap; // this is not like a config file, you can't randomly do that. Also, you don't specify who to slap, or for what damage     } } public cs_get_weapon_id { // you pass no parameter (id), and also you assume it'll be called (which it won't)     if cs_get_weapon_id(id, weapon, CSW_SG550 ) // wrap brackets around the condition, and also you don't pass correct parameters. Is cs_get_weapon_id even a func?     { // bracket out of place, you need to close it just before else         client_print("Somebody has an Auto, watch out!") // you don't tell client_print who to print it to, or where     else // not opened or closed         client_print("No worries about Auto this round") // you don't tell client_print who to print it to, or where         server_print("No worries about Auto this round") // you don't tell client_print who to print it to, or where     } // bracket out of place, open at else } public event_fire { // you pass no parameters (id), and also you already have a function with the same name as this, also nothing calls this     if client_fire(CSW_SG550,"autoslap") // what? You're saying if they have an 550 to slap them? Also, wrap brackets around the condition     {         server_slap_client; wait; server_slap_client; wait // this is just too funny for words     } } public not_drop { // you pass no parameters (id), also nothing calls it     if client_fire(CSW_AWP,"awpslap_damage") // there is no symbol "client_fire", and also wrap brackets around this     {         server_slap_client 20; wait; serverslap client 79 // again, too funny for words     } } public not_drop { // you don't pass any parameters, and also theres already a symbol with this name, also nothing calls it     if client_fire(CSW_SG550 or CSW_G3SG1,"autoslap_damage") // what? I think you're trying to do like event_fire     {         server_slap_client 20; wait; serverslap client 79 // again, you do the same thing. This is not a config file, it's a script.     } } public get_user_health { // already a function built into AMXX, also you pass no parameters(id), also nothing calls it     if (is_user_alive  == 1 and cs_get_weapon_id == CSW_AWP) // you pass no parameters into is_user_alive(id), the correct symbol for "and" is &&, and cs_get_weapon_id returns nothing     { // terrible indentation inside these brackets     client_cmd ("kill") // who?     client_print("You shouldn't have used an awp.") // don't specify who to print to or where     client_print("You have been punished") // ^^^^^^^^^^^^^^^^^^^^^^     client_print("Drop the AWP next time :)") // ^^^^^^^^^^^^^^^^^^^^^     server_print("Hopefully you have learned a lesson") // ^^^^^^^^^^^^^     } } public say_after { // nothing calls this, also you pass no parameters into it, (id)     if (is_user_alive  == 1 and cs_get_weapon_id == CSW_SG550) // &&, not and, also you pass no id into is_user_alive, and cs_get_weapon_id returns nothing     { // just refer to get_user_health (the func above this)     client_cmd ("kill")     client_print("You shouldn't have used a SG550.")     client_print("You have been punished")     client_print("Drop the SG550 next time :)")     server_print("Hopefully he has learned a lesson")     } } public say_after { // already exists, nothing calls this, and you pass no parameters into it (id)     if (is_user_alive  == 1 and cs_get_weapon_id == CSW_G3SG1) // refer to 2 functions above this     {     client_cmd ("kill")     client_print("You shouldn't have used an G3SG1.")     client_print("You have been punished")     client_print("Drop the G3SG1 next time :)")     server_print("Hopefully you have learned a lesson")     } } public Roundstart(id) { // hooray! You actually passed an id into this, too bad it's a global event. Also, nothing calls it.     if (cs_roundstart == 1) // where did you get cs_roundstart from?     { // bad indentation     server_print("No AWPs or Autos!!!") // alright... won't help the server op much     console_print("No AWPs or Autos!!!") // to who?     client_print("No AWPS or AUTOS!!!") // to who and where?     } }

SweatyBanana 01-06-2006 12:29

You don't get the point?

Looks like its a simple, not well coded, (AWP & Autosnipe) Slap plugin.

Hawk552 01-06-2006 12:32

Quote:

Originally Posted by SweatyBanana
You don't get the point?

Looks like its a simple, not well coded, (AWP & Autosnipe) Slap plugin.

Yes I understand that, but I don't get the point of all his functions after event_fire.

Venomxtinct 01-06-2006 15:25

yeah i know it sucks, but its the best of my ability at the moment...

Hawk552 01-06-2006 15:31

You should read the documentation, and the scripting tutorials. They'll help you a lot.

Venomxtinct 01-10-2006 11:50

1 Attachment(s)
ok, I read one of those basic tutorials, and Ive started over from scratch. how does it look now?


also I think i might change the plugin around a little bit, instead of slapping them to death, maybe disarm them and give them a different weapon... I'll work on that after I get the basics of the plugin done...

Hawk552 01-10-2006 15:18

I don't see a question? (at least one that will benefit anyone)

But if you're looking for it to be optimized, here:

Code:
#include <amxmodx> #include <amxmisc> public public_init() {     register_plugin ("Awp/Auto Slapper","0.1","Venomxtinct")     register_concmd ("amx_awpslap","do_slap",ADMIN_KICK," - <name> <health> - slaps user for health") } public do_slap(id,level,cid) {     if(!cmd_access(id,level,cid,3))     {         return PLUGIN_HANDLED     }         new user[32],health[4],ammo,clip,weap = get_user_weapon(id,clip,ammo)     read_argv(1,user,32)     read_argv(2,health,3)         new hp = str_to_num(health), uid = cmd_target(id,user,1)         if(weap == CSW_AWP)     {         weap = 1         user_slap(id,hp,1)     }     else if(weap == CSW_SG550 || weap == CSW_G3SG1)     {         weap = 0         user_slap(id,hp,1)     }         new name[2][32]     get_user_name(id,name[0],31)     get_user_name(uid,name[1],31)         switch(get_cvar_num("amx_show_activity"))     {         case 1 : client_print(0,print_chat,"[AMXX] %s has been slapped for %i health for having %s.",name[1],hp,weap ? "an autosniper" : "an AWP")         case 2 : client_print(0,print_chat,"ADMIN %s: slapped %s for %i health for having %s.",name[0],name[1],hp,weap ? "an autosniper" : "an AWP")     }         return PLUGIN_HANDLED }


All times are GMT -4. The time now is 15:46.

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