Raised This Month: $ Target: $400
 0% 

What is wrong here???


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
joecaprini
Junior Member
Join Date: Jul 2004
Location: In a blackhole
Old 07-12-2004 , 17:40   What is wrong here???
Reply With Quote #1

Yes, Im sort of new to this whole scripting thing. But, if you could, plz tell me what is wrong.

/*AMX MOD X SCRIPT
*
*AWP DOGWAR
*
*This script makes everyone use a awp and ammo
*
*Version 1.0
*
*Created by IseeOWNEDpeople AKA JoeCaprini
*/
#include <amxmodx>
#include <amxmisc>
]#include <fun>

public plugin_init(){
register_plugin("AWP DOGWAR","1.0","IseeOWNEDpeople")
register_concmd("amx_awpwar","doggystyle",ADM IN_IMMUNITY,"1 = On 2 = Off")
register_cvar("amx_awpwar","1")
register_clcmd("ammo","outofmo",-1,": Gives you more ammo")
}

public doggystyle(id){
if(get_cvar_num("amx_awpwar") == 0){
return PLUGIN_HANDLED
}

if(get_cvar_num("amx_awpwar") == 1){
new clip, ammo
new usersweapon = get_user_ammo(id,clip,ammo)

client_cmd(id, "drop")

give_item(id,weapon_awp)
give_item(id,ammo_338magnum)
give_item(id,ammo_338magnum)
give_item(id,ammo_338magnum)
}

client_print(0,print_chat,"[AWPFIGHT] AWP FIGHT IS ON")
}

public ammo(id){
new clip, ammo
new usersweapon = get_user_ammo(id,clip,ammo)

give_item(id,ammo_338magnum)
give_item(id,ammo_338magnum)
}
__________________
-JOECAPRINI-
joecaprini is offline
Send a message via AIM to joecaprini
FrozenWire
Member
Join Date: Jun 2004
Old 07-12-2004 , 17:44  
Reply With Quote #2

/home/users/amxmodx/tmp/3w5n8BNF.sma(29) : warning 219: local variable "ammo" shadows a variable at a preceding level
/home/users/amxmodx/tmp/3w5n8BNF.sma(30) : warning 202: number of arguments does not match definition
/home/users/amxmodx/tmp/3w5n8BNF.sma(34) : error 017: undefined symbol "weapon_awp"
/home/users/amxmodx/tmp/3w5n8BNF.sma(35) : error 017: undefined symbol "ammo_338magnum"
/home/users/amxmodx/tmp/3w5n8BNF.sma(36) : error 017: undefined symbol "ammo_338magnum"
/home/users/amxmodx/tmp/3w5n8BNF.sma(37) : error 017: undefined symbol "ammo_338magnum"
/home/users/amxmodx/tmp/3w5n8BNF.sma(41) : warning 209: function "doggystyle" should return a value
/home/users/amxmodx/tmp/3w5n8BNF.sma(44) : warning 219: local variable "ammo" shadows a variable at a preceding level
/home/users/amxmodx/tmp/3w5n8BNF.sma(45) : warning 202: number of arguments does not match definition
/home/users/amxmodx/tmp/3w5n8BNF.sma(47) : error 017: undefined symbol "ammo_338magnum"
/home/users/amxmodx/tmp/3w5n8BNF.sma(4 : error 017: undefined symbol "ammo_338magnum"


Out of my knowledge. My guess would be check the model to make sure its correct and you incuded the a list of models but thats just my guess. Im not too sure on this.
__________________
Bryan Benway
FrozenWire Networks
Game Servers | Web Design | Web Hosting
http://frozenwire.com
FrozenWire is offline
Send a message via AIM to FrozenWire
joecaprini
Junior Member
Join Date: Jul 2004
Location: In a blackhole
Old 07-12-2004 , 18:17   FIXED IT!!!
Reply With Quote #3

I had to put a return PLUGIN_HANDLED in there. Now it compiled

/*AMX MOD X SCRIPT
*
*AWP DOGWAR
*
*This script makes everyone use a awp and ammo
*
*Version 1.0
*
*Created by IseeOWNEDpeople AKA JoeCaprini
*/

#include <amxmodx>
#include <amxmisc>
#include <fun>

public plugin_init(){
register_plugin("AWP DOGWAR","1.0","IseeOWNEDpeople")
register_concmd("amx_awpwar","doggystyle",ADM IN_IMMUNITY,"1 = On 2 = Off")
register_cvar("amx_awpwar","1")
register_clcmd("ammo","outofmo",-1,": Gives you more ammo")
}

public doggystyle(id){
if(get_cvar_num("amx_awpwar") == 0){
return PLUGIN_HANDLED
}

if(get_cvar_num("amx_awpwar") == 1){
client_cmd(id, "drop")


give_item(id,"weapon_awp")
give_item(id,"ammo_338magnum")
give_item(id,"ammo_338magnum")
give_item(id,"ammo_338magnum")
client_print(0,print_chat,"[AWPFIGHT] AWP FIGHT IS ON")
}
return PLUGIN_HANDLED
}

public ammo(id){

give_item(id,"ammo_338magnum")
give_item(id,"ammo_338magnum")
}
__________________
-JOECAPRINI-
joecaprini is offline
Send a message via AIM to joecaprini
kingpin
Veteran Member
Join Date: Apr 2004
Location: kpsforum.com
Old 07-12-2004 , 18:21  
Reply With Quote #4

please use [ small][/small ]

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init(){ register_plugin("AWP DOGWAR","1.0","IseeOWNEDpeople") register_concmd("amx_awpwar","doggystyle",ADMIN_IMMUNITY,"1 = On 2 = Off") register_cvar("amx_awpwar","1") register_clcmd("ammo","outofmo",-1,": Gives you more ammo") } public doggystyle(id){ if(get_cvar_num("amx_awpwar") == 0){ return PLUGIN_HANDLED } if(get_cvar_num("amx_awpwar") == 1){ client_cmd(id, "drop") give_item(id,"weapon_awp") give_item(id,"ammo_338magnum") give_item(id,"ammo_338magnum") give_item(id,"ammo_338magnum") client_print(0,print_chat,"[AWPFIGHT] AWP FIGHT IS ON") } return PLUGIN_HANDLED } public ammo(id){ give_item(id,"ammo_338magnum") give_item(id,"ammo_338magnum") }
__________________
kingpin is offline
Send a message via ICQ to kingpin Send a message via AIM to kingpin Send a message via MSN to kingpin Send a message via Yahoo to kingpin Send a message via Skype™ to kingpin
joecaprini
Junior Member
Join Date: Jul 2004
Location: In a blackhole
Old 07-12-2004 , 19:08  
Reply With Quote #5

I tried to make a batman script after this. Why doesn't it work???

Code:
/*AMX MOD X SCRIPT * *Batman Weapons * *Gives all rifles * *Version 1.1 * *Created by IseeOWNEDpeople AKA JoeCaprini */ #include <amxmodx> #include <amxmisc> #include <fun> public plugin_init(){ register_plugin("Batman Weapons","1.1","IseeOWNEDpeople") register_concmd("amx_batman","brucewayne",ADMIN_IMMUNITY,"1 = On 2 = Off") register_cvar("amx_batman","1") } public brucewayne(id){ if(get_cvar_num("amx_batman") == 0){ return PLUGIN_HANDLED } if(get_cvar_num("amx_batman") == 1){ give_item(id,"weapon_awp") give_item(id,"weapon_m4a1") give_item(id,"weapon_ak47") give_item(id,"weapon_aug") give_item(id,"weapon_sg552") give_item(id,"weapon_mp5navy") give_item(id,"weapon_xm1014") give_item(id,"weapon_elite") give_item(id,"weapon_deagle") give_item(id,"weapon_flashbang") give_item(id,"weapon_hegrenade") give_item(id,"weapon_smokegrenade") } return PLUGIN_HANDLED }
__________________
-JOECAPRINI-
joecaprini is offline
Send a message via AIM to joecaprini
Blunted1
Senior Member
Join Date: Jun 2004
Old 07-12-2004 , 20:55  
Reply With Quote #6

Quote:
Originally Posted by joecaprini
I tried to make a batman script after this. Why doesn't it work???

-code-
I dunno, but if you tell me I will help you fix it
Obviously you must have some more information than it doesnt work.
Does it compile? Does it give you compileing errors or warnings?
Can you get it to load in game? Does it not do what you want it to? etc etc etc

[Edit] at first glance it appears that you have tried to do everything at once.
The admin requirments aren't set properly and you called the same cvar twice for the same purpose.
If you haven't already, start from the beggining and work your way up one step at a time

Code:
/*AMX MOD X SCRIPT * *Batman Weapons * *Gives all rifles * *Version 1.1 * *Created by IseeOWNEDpeople AKA JoeCaprini */ #include <amxmodx> #include <amxmisc> #include <fun> public plugin_init(){ register_plugin("Batman Weapons","1.1","IseeOWNEDpeople") register_concmd("amx_batman","brucewayne") } public brucewayne(id){ give_item(id,"weapon_awp") give_item(id,"weapon_m4a1") give_item(id,"weapon_ak47") give_item(id,"weapon_aug") give_item(id,"weapon_sg552") give_item(id,"weapon_mp5navy") give_item(id,"weapon_xm1014") give_item(id,"weapon_elite") give_item(id,"weapon_deagle") give_item(id,"weapon_flashbang") give_item(id,"weapon_hegrenade") give_item(id,"weapon_smokegrenade") }

This works.
Anyone can use it, and it is always on.
First you would need to add a cvar to turn on/off. Compile it. Test it.
Then add admin requirments. Compile it. Test it.

That way you will know what is wrong and if you cannot solve the problem you can say "I tried to add an on/off cvar and now it doesnt work when I enter the command in game" or something similar.
Blunted1 is offline
Blunted1
Senior Member
Join Date: Jun 2004
Old 07-12-2004 , 21:12  
Reply With Quote #7

Code:
/*AMX MOD X SCRIPT * *Batman Weapons * *Gives all rifles * *Version 1.1 * *Created by IseeOWNEDpeople AKA JoeCaprini */ #include <amxmodx> #include <amxmisc> #include <fun> public plugin_init(){ register_plugin("Batman Weapons","1.1","IseeOWNEDpeople") register_concmd("amx_batman","brucewayne",ADMIN_IMMUNITY,"1 = on 2 = off") register_cvar("amx_batman","1") } public brucewayne(id, level, cid){    if (!cmd_access(id,level,cid,2))       return PLUGIN_HANDLED    if (get_cvar_num("amx_batman")!=0){     give_item(id,"weapon_awp")     give_item(id,"weapon_m4a1")     give_item(id,"weapon_ak47")     give_item(id,"weapon_aug")     give_item(id,"weapon_sg552")     give_item(id,"weapon_mp5navy")     give_item(id,"weapon_xm1014")     give_item(id,"weapon_elite")     give_item(id,"weapon_deagle")     give_item(id,"weapon_flashbang")     give_item(id,"weapon_hegrenade")     give_item(id,"weapon_smokegrenade")    }    return PLUGIN_HANDLED }

There ya go, done properly.
[edit\]I should warn you though, this still will not work.
You have named the client command and the cvar as the same thing and I believe you will have to choose who you are doing this to [/edit]

The plugin written by you above (AWP War) will most likely be accessable by everyone and not just admins as you made the same mistake in that plugin.

If you cannot spot the difference on your own just ask and I will point it out (but give it a good decent shot, it shouldn't be too dificult)
Blunted1 is offline
Blunted1
Senior Member
Join Date: Jun 2004
Old 07-12-2004 , 21:35  
Reply With Quote #8

Here is your code completily finished for you.

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init(){ register_plugin("Batman Weapons","1.1","IseeOWNEDpeople") register_concmd("amx_batman","admin_batman",ADMIN_IMMUNITY) register_cvar("amx_batmanon","1") } public admin_batman(id,level,cid){    if (!cmd_access(id,level,cid,2))       return PLUGIN_HANDLED    new arg[32], name2[32]    get_user_name(id,name2,31)    read_argv(1,arg,31)        if (arg[0]=='@'){       new players[32], inum       get_players(players,inum,"ae",arg[1])       if (inum==0){          console_print(id,"No clients in such team")          return PLUGIN_HANDLED       }       for(new a=0;a<inum;++a)          brucewayne(players[a])      }    else {       new player = cmd_target(id,arg,2)       if (!player) return PLUGIN_HANDLED       brucewayne(player)       new name[32]       get_user_name(player,name,31)      }    return PLUGIN_HANDLED   } public brucewayne(id){    if (get_cvar_num("amx_batmanon")!=0){     give_item(id,"weapon_awp")     give_item(id,"weapon_m4a1")     give_item(id,"weapon_ak47")     give_item(id,"weapon_aug")     give_item(id,"weapon_sg552")     give_item(id,"weapon_mp5navy")     give_item(id,"weapon_xm1014")     give_item(id,"weapon_elite")     give_item(id,"weapon_deagle")     give_item(id,"weapon_flashbang")     give_item(id,"weapon_hegrenade")     give_item(id,"weapon_smokegrenade")    }    return PLUGIN_HANDLED }

Everything works.
Command: amx_batman <authid, nick, @team or #userid>
Blunted1 is offline
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 07-12-2004 , 23:30  
Reply With Quote #9

Use Small tags when you post plugin codes.
Peli is offline
Send a message via MSN to Peli
Blunted1
Senior Member
Join Date: Jun 2004
Old 07-12-2004 , 23:34  
Reply With Quote #10

Quote:
Originally Posted by kingpin
please use [ small][/small ]
It has been said, and it has been done
Blunted1 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:38.


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