Raised This Month: $ Target: $400
 0% 

Some feedback


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 04-05-2004 , 23:26   Some feedback
Reply With Quote #1

I recently learned how to use the temporary event commands, and I decided to test my skills. I wanted to see if I was capable of making a laser beam like the plugin Ludwig Van Laser Guns. I understand that this was made, and Im not going to post the finished product. This is simply for personal use and practice at my writing skills. I would like some feedback on this. I would like to know if there are better ways to write this, and if certian things wont work. I dont have a server myself, and I can only test it on my lan server. Im not sure if the laser does dmg, other ppl cant get in my server. Heres the code:

Code:
///////////////////// #include <amxmodx> #include <cstrike> #include <fun> ///////////////////// #define TEAM_T 1 #define TEAM_CT 2 ///////////////////// new origin[33][3] new laser, red, blue ///////////////////// public plugin_init() {     register_plugin("Laser Cannons","0.1","Knekter")     register_clcmd("fire_laser","laser_init")     register_clcmd("say /lasers","laser_help")     register_logevent("StartRound",2,"1=Round_Start") } ///////////////////// public plugin_precache() {     laser = precache_model("sprites/laserbeam.spr")     precache_sound("weapons/electro5.wav")     precache_sound("buttons/bell1.wav")     return PLUGIN_CONTINUE } ///////////////////// public StartRound() {         set_hudmessage(0, 255, 0, -1.0, 0.3, 0, 1.0, 5.0, 0.1, 0.2, 4)         show_hudmessage(0,"Lasers are currently enabled! Say /lasers for help") } public laser_init(id) {     if(get_user_armor(id) < 10)     {         client_print(id,print_chat,"[AMXX] You ran of energy for your laser gun!")         emit_sound(0,CHAN_ITEM,"buttons/bell1.wav",1.0,ATTN_NORM,0,PITCH_NORM)         return PLUGIN_HANDLED     }     new armor = get_user_armor(id)     set_user_armor(id,armor - 10)     new name[33]     get_user_name(id,name,32)     new team = cs_get_user_team(id)     if(team == 1)     {         red = 255         blue = 0     }     else     {         red = 0         blue = 255     }     new victum, pHit     new vname[33]     get_user_aiming(id,victum,pHit,9999)     get_user_name(victum,vname,32)     get_user_origin(id,origin[id],3)     emit_sound(0,CHAN_ITEM,"weapons/electro5.wav",1.0,ATTN_NORM,0,PITCH_NORM)     message_begin(MSG_BROADCAST,SVC_TEMPENTITY)     write_byte(1) // TE_BEAMENTPOINT     write_short(id) // ent     write_coord(origin[id][0]) // x     write_coord(origin[id][1]) // y     write_coord(origin[id][2]) // z     write_short(laser) // sprite     write_byte(1) // start frame     write_byte(1) // framerate     write_byte(2) // life     write_byte(10) // width     write_byte(0) // noise     write_byte(red)     write_byte(0)     write_byte(blue)     write_byte(200)     write_byte(1) // scroll speed     message_end()     new vHP = get_user_health(vname[id])     if(pHit == 1)     {         user_kill(vname[id])         return PLUGIN_HANDLED     }     if(pHit == 2 || pHit == 3)     {         vHP = (vHP - 30)         set_user_health(vname[id],vHP)         return PLUGIN_HANDLED     }     if(pHit == 4 || pHit == 5)     {         vHP = (vHP - 20)         set_user_health(vname[id],vHP)         return PLUGIN_HANDLED     }     if(pHit == 6 || pHit == 7)     {         vHP = (vHP - 15)         set_user_health(vname[id],vHP)         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED } public laser_help(id) {     show_motd(id,"/addons/amxx/laser.txt","Laser Help")     return PLUGIN_HANDLED }

I also get the following warnings and I cant figure out how to fix it:

Code:
Small compiler 2.1.0            Copyright (c) 1997-2002, ITB CompuPhase

C:\Steam\SteamApps\[email protected]\counter-strike\cstrike\addons\amxx\scripting\include\amxmodx.inc(121) : warning 219: local variable "red" shadows a variable at a preceding level
C:\Steam\SteamApps\[email protected]\counter-ctrike\cstrike\addons\amxx\scripting\include\amxmodx.inc(121) : warning 219: local variable "blue" shadows a variable at a preceding level
C:\Steam\SteamApps\[email protected]\counter-strike\cstrike\addons\amxx\scripting\include\amxmodx.inc(242) : warning 219: local variable "origin" shadows a
variable at a preceding level
C:\Steam\SteamApps\[email protected]\counter-strike\cstrike\addons\amxx\scripting\include\amxmodx.inc(449) : warning 219: local variable "origin" shadows a variable at a preceding level
C:\Steam\SteamApps\[email protected]\counter-strike\cstrike\addons\amxx\scripting\include\fun.inc(33) : warning 219: local variable "origin" shadows a variable at a preceding level

5 Warnings.
Press any key to continue . . .
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
dragonchaos
Member
Join Date: Mar 2004
Old 04-06-2004 , 10:07  
Reply With Quote #2

you could do 2 things.
1. you could ignore the warnings since they are just warnings, or
2. you could rename your variables to PlayerOrigin (just an example), and clrRed, clrBlue

these basically say that blue,red,and origin have been used in the original coding i believe
dragonchaos is offline
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 04-06-2004 , 10:22   thx
Reply With Quote #3

thx, but why would I have a pluign with errors, when I can fix them? too me it just seems right.
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 04-06-2004 , 10:30   hmm
Reply With Quote #4

anyone else want to say anything?
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
dragonchaos
Member
Join Date: Mar 2004
Old 04-06-2004 , 11:08  
Reply With Quote #5

Quote:
Originally Posted by dragonchaos
could rename your variables to PlayerOrigin (just an example), and clrRed, clrBlue
this should be how to fix them, warnings are not errors ...
dragonchaos is offline
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 04-06-2004 , 11:10   thx
Reply With Quote #6

I red your reply before and I did fix them, thx again
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 04-08-2004 , 19:05   hmmm
Reply With Quote #7

theres a problem, when I shoot at some1, it doesnt work its getting me very frustrated
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
dragonchaos
Member
Join Date: Mar 2004
Old 04-08-2004 , 22:09  
Reply With Quote #8

Code:
   new vHP = get_user_health(victum)     if(pHit == 1)     {         user_kill(victum)         return PLUGIN_HANDLED     }     if(pHit == 2 || pHit == 3)     {         vHP = (vHP - 30)         set_user_health(victum,vHP)         return PLUGIN_HANDLED     }     if(pHit == 4 || pHit == 5)     {         vHP = (vHP - 20)         set_user_health(victum,vHP)         return PLUGIN_HANDLED     }     if(pHit == 6 || pHit == 7)     {         vHP = (vHP - 15)         set_user_health(victum,vHP)         return PLUGIN_HANDLED     }

i can't highlight the changes but where it says victum, thats what I changed. You had it sending the victim's name to the functions, when it needs the index. this works. I tested it.
dragonchaos is offline
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 04-08-2004 , 22:19   hehe
Reply With Quote #9

hehe, silly me thx alot!
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
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 09:19.


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