AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   first time plz help (https://forums.alliedmods.net/showthread.php?t=25048)

warchild690 03-06-2006 20:39

first time plz help
 
1 Attachment(s)
ok im trying to write a pistols only mod, similar to knifes only, it is mostly writen from scratch but i borrowed bits-n-peices from a knifes only mod,

i have bunches of errors that i have no idea how to fix


Welcome to the AMX Mod X 1.70-300 Compiler.
Copyright (c) 1997-2005 ITB CompuPhase, AMX Mod X Team

/home/users/amxmodx/tmp3/phpExvPVA.sma(2) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp3/phpExvPVA.sma(2 -- 4) : warning 215: expression has no effect
/home/users/amxmodx/tmp3/phpExvPVA.sma(4) : error 010: invalid function or declaration
/home/users/amxmodx/tmp3/phpExvPVA.sma(8 -- 9) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp3/phpExvPVA.sma(10) : error 010: invalid function or declaration
/home/users/amxmodx/tmp3/phpExvPVA.sma(14) : error 017: undefined symbol "read_argv"
/home/users/amxmodx/tmp3/phpExvPVA.sma(15) : error 017: undefined symbol "set_hudmessage"
/home/users/amxmodx/tmp3/phpExvPVA.sma(16) : error 017: undefined symbol "equal"
/home/users/amxmodx/tmp3/phpExvPVA.sma(17) : error 017: undefined symbol "usponly"
/home/users/amxmodx/tmp3/phpExvPVA.sma(17 -- 18) : warning 215: expression has no effect
/home/users/amxmodx/tmp3/phpExvPVA.sma(18) : error 017: undefined symbol "client_cmd"
/home/users/amxmodx/tmp3/phpExvPVA.sma(19) : error 017: undefined symbol "console_print"
/home/users/amxmodx/tmp3/phpExvPVA.sma(20) : error 017: undefined symbol "show_hudmessage"
/home/users/amxmodx/tmp3/phpExvPVA.sma(21) : error 017: undefined symbol "equal"
/home/users/amxmodx/tmp3/phpExvPVA.sma(22) : error 017: undefined symbol "usponly"
/home/users/amxmodx/tmp3/phpExvPVA.sma(22 -- 23) : warning 215: expression has no effect
/home/users/amxmodx/tmp3/phpExvPVA.sma(23) : error 017: undefined symbol "console_print"
/home/users/amxmodx/tmp3/phpExvPVA.sma(24) : error 017: undefined symbol "show_hudmessage"
/home/users/amxmodx/tmp3/phpExvPVA.sma(26) : error 017: undefined symbol "usponly"
/home/users/amxmodx/tmp3/phpExvPVA.sma(27) : error 017: undefined symbol "console_print"
/home/users/amxmodx/tmp3/phpExvPVA.sma(29) : error 017: undefined symbol "usponly"
/home/users/amxmodx/tmp3/phpExvPVA.sma(30) : error 017: undefined symbol "console_print"
/home/users/amxmodx/tmp3/phpExvPVA.sma(33) : warning 217: loose indentation
/home/users/amxmodx/tmp3/phpExvPVA.sma(33) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp3/phpExvPVA.sma(33) : error 017: undefined symbol "usp"
/home/users/amxmodx/tmp3/phpExvPVA.sma(34) : warning 217: loose indentation
/home/users/amxmodx/tmp3/phpExvPVA.sma(34) : error 017: undefined symbol "usponly"
/home/users/amxmodx/tmp3/phpExvPVA.sma(37) : error 017: undefined symbol "usponly"
/home/users/amxmodx/tmp3/phpExvPVA.sma(38) : error 003: declaration of a local variable must appear in a compound block
/home/users/amxmodx/tmp3/phpExvPVA.sma(38) : warning 217: loose indentation
/home/users/amxmodx/tmp3/phpExvPVA.sma(38) : error 017: undefined symbol "clip"
/home/users/amxmodx/tmp3/phpExvPVA.sma(38) : error 017: undefined symbol "ammo"

Compilation aborted.
26 Errors.
Could not locate output file /home/groups/amxmodx/public_html/websc3/phpExvPVA.amx (compile failed).

those are my errors






plz help me
also, plz tell me how to fix them, dont just do for me, i need to learn

thnx bunches

sry bout having to dl it, im to retarded to figure out how to post it[/code]

Brad 03-06-2006 20:57

Try fixing your errors one at a time, starting with the first one listed. Often, subsequent errors are a result of previous errors.

It looks like most of your errors are stemming from the same thing. Every function must be in the form of:
Code:
public myFunction(myArgs) {    // code }
Compare that to how you have your functions defined.

warchild690 03-06-2006 22:30

thnx u, wich one to change tho, i have no idea, or wat to change them to

c0rdawg 03-06-2006 22:40

post your code

warchild690 03-06-2006 22:46

just dl the sma file , like i said im to retarded to post it

Xanimos 03-06-2006 22:47

he also needs
#include <amxmodx>

warchild690 03-06-2006 23:00

thnx but that didnt get rid of ne errors :cry:

Brad 03-06-2006 23:03

This is his code for people like c0rdawg that don't seem to know how to download attached files.

Get ready to feel your eyes burn...

Code:
public plugin_init() )         register_concmd("amx_usp", "cmd_usp", ADMIN_SLAY, "@ALL") ) public cmd_usp(id, level, cid) (     if (!cmd_access(id, level, cid, 2))         return PLUGIN_HANDLED         public cmdusp_only(id){    new arg[2]    read_argv(1,arg,1)    set_hudmessage(200, 100, 0, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, 2)    if(equal(arg,"1")){    usponly = 1    client_cmd(id,"weapon_usp")    console_print(id,"usp Only has been turned on.")    show_hudmessage(0,"usp Only has been turned on.")    } else if(equal(arg,"0")){    usponly = 0    console_print(id,"usp Only has been turned off.")    show_hudmessage(0,"usp Only has been turned off.")    } else {    if (usponly==0){    console_print(id,"Usage: amx_usponly 1 = 0n 0 = off Currently: OFF")    }    if (usponly==1){    console_print(id,"Usage: amx_usponly 1 = 0n 0 = off Currently: ON")     public usp(id)         if (usponly==0)             //nothing                     if (usponly==1)             new clip, ammo             new usersweapon = get_user_weapon(id, clip, ammo)             client_cmd(id, "drop")             if(usersweapon==CSW_USP)                 //nothing             if(usersweapon==CSW_FLASHBANG)                 //nothing             if(usersweapon==CSW_SMOKEGRENADE)                 //nothing                                 client_cmd(id, "weapon_usp")         )         return PLUGIN_HANDLED )

Now, in answer to your most recent question... Your first error indicated a problem with line 2. Look at your line 2.

Compare this function:
Code:
public plugin_init() ) // <--- this is line 2         register_concmd("amx_usp", "cmd_usp", ADMIN_SLAY, "@ALL") )
To this "model function":
Code:
public myFunction() {    // code }
See the differences?

c0rdawg 03-06-2006 23:22

hehe i'm sorry, I didn't notice that he posted the sma... sorry :oops:

Yeah theres alot of errors in this code
don't forget to include amxmodx and amxmisc

also make sure you close all your functions...
cmdusp_only isn't closed

also the variabled usponly is never defined...

theres probably some more errors but thats what i noticed quickly

warchild690 03-07-2006 16:42

thnx u but i still cant get rid of ne of the errors, her is the updated code, i might have fucked it up more but idk...
Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init()
(
        //register_concmd("amx_usp", "cmd_usp", ADMIN_SLAY, "@ALL")
)

public cmd_usp(id, level, cid)
(
        if (!cmd_access(id, level, cid, 2))
                return PLUGIN_HANDLED
)


public cmdusp_only(id){
  new arg[2]
  read_argv(1,arg,1)
  set_hudmessage(200, 100, 0, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, 2)
  if(equal(arg,"1")){
  usponly = 1
  client_cmd(id,"weapon_usp")
  console_print(id,"usp Only has been turned on.")
  show_hudmessage(0,"usp Only has been turned on.")
  } else if(equal(arg,"0")){
  usponly = 0
  console_print(id,"usp Only has been turned off.")
  show_hudmessage(0,"usp Only has been turned off.")
  } else {
  if (usponly==0){
  console_print(id,"Usage: amx_usponly 1 = 0n 0 = off Currently: OFF")
  }else(
  if (usponly==1){
  console_print(id,"Usage: amx_usponly 1 = 0n 0 = off Currently: ON")
)
public usp(id)(
        if (usponly==0)
                //nothing
                       
        if (usponly==1)
                new clip, ammo
                new usersweapon = get_user_weapon(id, clip, ammo)
                client_cmd(id, "drop")
                if(usersweapon==CSW_USP)
                        //nothing
                if(usersweapon==CSW_FLASHBANG)
                        //nothing
                if(usersweapon==CSW_SMOKEGRENADE)
                        //nothing
                               
                client_cmd(id, "weapon_usp")
       
)       
(
                return PLUGIN_HANDLED

)


yay i figured it out


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

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