Raised This Month: $ Target: $400
 0% 

How do you give weapons?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rolnaaba
Veteran Member
Join Date: May 2006
Old 05-22-2006 , 08:02   How do you give weapons?
Reply With Quote #1

I keep trying to give an AK47 using this comand
Code:
give_item(id, CSW_AK47)
but it gives me the compiler error:
Code:
Error: Expected token: ";", but found ")" on line 36
Error: Invalid expression, assumed zero on line 36
Error: Too many error messages on one line on line 36
can someone plz help me?
*NOTE* Line 36 is the line with that give_item comand on it
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Stephen
Senior Member
Join Date: Aug 2004
Old 05-22-2006 , 08:25  
Reply With Quote #2

you should post the full source so the error could be found easier.
also it oculd mean this here

Code:
 give_item(id, CSW_AK47)

into

Code:
 give_item(id, "CSW_AK47")
__________________
www.corona-bytes.net (ECX = ESF Addon)
Stephen is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 05-22-2006 , 08:26  
Reply With Quote #3

all the errors are found on the line I gave you and I gave you all the source code for that line...
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 05-22-2006 , 08:28  
Reply With Quote #4

I am making a mod that give you a powered up AK here is all that I have so far:
Code:
//*****{INCLUDES}***** #include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #include <fakemeta> #include <engine> //*****{PRECATCH AK MODELS}***** public plugin_precache() {     precache_model("models/p_ak47.mdl")     precache_model("models/v_ak47.mdl")     precache_model("models/w_ak47.mdl") } //*****{PLUGIN INIT}***** public plugin_init() {     register_plugin("SilverAK", "1.0", "Rolnaaba")     register_cvar("admin_silverAK", "1")     register_cvar("admin_AKcost", "4200")     register_clcmd("/buyak", "cmd_buyak")     register_clcmd("/akprice", "func_akprice") } //*****{AK VALUE}***** new hasAK[33] //*****{BUY AK}***** public cmd_buyak(id, cid) {     new arg[32]     read_argv(1, arg, 31)     new player=cmd_target(id, arg, 2)     new id=read_data(2)     {                 hasAK[id] == 1         cs_set_user_money(id,cs_get_user_money(id)-get_cvar_num("admin_AKcost"))         give_item(id, CSW_AK47)         set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)         show_hudmessage(id, "You have bought the Silver AK!!")         if(get_user_weapon==weapon_ak47)         {             damage = damage*4/3         }     }     return PLUGIN_HANDLED } //*****{THIS IS SUPOSED TO LOWER RECOIL}***** public client_PreThink() {     if (hasAK[id] = 1 && get_user_weapon = CSW_AK47)     {         if(get_user_button(id) & IN_ATTACK)         {             entity_set_vector(id, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0});         }         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED } //*****{MODEL STUFF}***** if (hasAK[id]=1 && get_user_weapon=AK47) {     entity_set_string(id, EV_SZ_viewmodel, "models/v_ak47.mdl")     entity_set_string(id, EV_SZ_weaponmodel, "models/p_ak47.mdl")     entity_set_string(id, EV_SZ_model, "models/w_ak47.mdl")     return PLUGIN_HANDLED }
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 05-22-2006 , 08:31  
Reply With Quote #5

and while we are at it this is what all my compiler errors are god I thought was going to be a quick and easy mod!!
Code:
Welcome to the AMX Mod X 1.70-300 Compiler.
Copyright (c) 1997-2005 ITB CompuPhase, AMX Mod X Team

Warning: Expression has no effect on line 40
Error: Syntax error in the expression, or invalid function call on line 45
Error: Undefined symbol "damage" on line 47
Error: Undefined symbol "damage" on line 47
Warning: Expression has no effect on line 47
Warning: Symbol is assigned a value that is never used: "player" on line 51
Error: Undefined symbol "id" on line 55
Warning: Expression has no effect on line 55
Error: Expected token: ";", but found ")" on line 55
Error: Invalid expression, assumed zero on line 55
Error: Too many error messages on one line on line 55

Compilation aborted.
7 Errors.
Could not locate output file C:\Documents and Settings\CJ\My Documents\CJ's Documents\My Scripting\Compiled Scripts\SilverAK.amx (compile failed).
I know it couldnt find the output file because the compilation was aborted but if anyone could plz help me to fix these errors I would be eternally grateful
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 05-22-2006 , 08:32  
Reply With Quote #6

You should pass a weapon name, not a weapon ID.
Code:
give_item(id, "weapon_ak47")
VEN is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-22-2006 , 08:34  
Reply With Quote #7

Just read this:
http://forums.alliedmods.net/showthread.php?t=21366

The damage will require more work but it's still pretty easy.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 05-22-2006 , 18:52  
Reply With Quote #8

Code:
//*****{INCLUDES}***** #include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #include <engine> //*****{PRECATCH AK MODELS}***** public plugin_precache()     {     precache_model("models/p_ak47.mdl")     precache_model("models/v_ak47.mdl")     precache_model("models/w_ak47.mdl") } //*****{PLUGIN INIT}***** public plugin_init()     {     register_plugin("SilverAK", "1.0", "Rolnaaba")     register_cvar("admin_silverAK", "1")     register_cvar("admin_AKcost", "4200")     register_clcmd("/buyak", "cmd_buyak")     register_clcmd("/akprice", "func_akprice") } //*****{AK VALUE}***** new bool:hasAK[33] //*****{BUY AK}***** public cmd_buyak(id, cid){     if(get_cvar_num("admin_silverAK") == 0){         client_print(id,print_chat,"This mod is disabled")         return PLUGIN_HANDLED     }         new arg[32], ammo, clip     read_argv(1, arg, 31)     new player = cmd_target(id, arg, 2)     id = read_data(2)     {                 hasAK[id] = true         cs_set_user_money(id,cs_get_user_money(id)-get_cvar_num("admin_AKcost"))         give_item(player, "weapon_ak47")         set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)         show_hudmessage(id, "You have bought the Silver AK!!")         if(get_user_weapon(id,ammo,clip) == CSW_AK47)             {             // damg         }     }     return PLUGIN_HANDLED } //*****{THIS IS SUPOSED TO LOWER RECOIL}***** public client_PreThink(id){     new ammo, clip     if(hasAK[id] == true && get_user_weapon(id,ammo,clip) == CSW_AK47)         {         if(get_user_button(id) & IN_ATTACK)             {             entity_set_vector(id, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0})             entity_set_string(id, EV_SZ_viewmodel, "models/v_ak47.mdl")             entity_set_string(id, EV_SZ_weaponmodel, "models/p_ak47.mdl")             entity_set_string(id, EV_SZ_model, "models/w_ak47.mdl")         }         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED } public funcAKprice(id){     new price = get_cvar_num("admin_AKcost")     client_print(id,print_chat,"The Silver AK is %i",price)     return PLUGIN_HANDLED } public client_connect(id){     hasAK[id] = false } public client_disconnect(id){     hasAK[id] = false }
wonsae is offline
Reply


Thread Tools
Display Modes

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 16:23.


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