i don't understanding get_user_origin
okay my problem is that i want to use get_user_origin so i can have a bolt of lightning hit the person.. and at this point i get one error and one warning
one: error 029: invaild expression,assumed zero (on the line get_user_origin) second: warning 225: unreachable code (same thing) here is some of the code the section i am have problems with.. Code:
|
This is your exact same code that you posted, only changed slightly (includes, declaration of light variable, and inside a public function), and it works without any warnings:
Code:
Although maybe my compiler is broken. Change the z2 coord line so that + 10 is within the parentheses. |
ummm i know all of that.. did u read wat i posted??? i am showing u my problem and where it is.. wat i am asking is if u could help me figure out how to fix it
here i make it easier ill give u the whole code its been modify from someone elses code that he needed fixed and the reason i used it is because i want to learn how to make the lightning. for a plugin i am making . Code:
|
For starters, Avalanche did provide adequate help (but missed the write_coord(origin[id][2]) + 10 bit :P), you just didn't specify exactly what you wanted.. it seems more clear from your second post, so I will guess at what it is you want and try to provide a brief explanation..
Well, you dont need origin[33][3] if you are using the origins locally only, so use origin[3] instead, since you dont need to store the origins of every player when you are only using the origins of one player.. Basically, get_user_origin() function accepts 2 parameters: the id of the user to get the origin of (which I am sure you understood that) and secondly is an array of 3 variables which specify the X, Y, Z coordinates of the user in 3D Space... You simply make an array of 3 like: new MyOriginArray[3] Then pass it to the function like: get_user_origin( id, MyOriginArray ) Then, after the call to that function, the array will hold the users coordinates: MyOriginArray[0] will equal the X Coordinate MyOriginArray[1] will equal the Y Coordinate MyOriginArray[2] will equal the Z Coordinate Also, try not to return PLUGIN_HANDLED from AMXX Forwards like plugin_init() or plugin_precache() etc.. , return PLUGIN_CONTINUE instead.. You dont need to include <amxconst> since it is included already by <amxmodx> This block is completely wrong: Code:
if(get_user_flags(id)&&ADMIN_KICK) should be: if(get_user_flags(id)&ADMIN_KICK) Notice the single ampersand (&) which specifies Bit-Wise Comparison... Also there should be Curly-Brackets around the first IF clause (because you have more than one statement), the "else" should be "else if" since you are specifying an additional comparison (otherwise leave out everything after "else" on the same line) Plus your logic is wrong, you have: If the user has Access give god mode then exit function, else if user doesnt have access then print a message and do the lightning effect (which seems wrong, maybe that was your intentions, idk)... Lastly, you had: write_coord(origin[2]) + 10 // z2 coord which should be: write_coord(origin[2] + 10) // z2 coord Notice the + 10 is inside the brackets, so that the sum is calculated first, then the resulting value is passed to the write_coord() function.. I hope that helps a bit, also here is a revised version (not tested).. Code:
|
blood you should be writing scripts not semi tutorials :D
|
:) heehee, i guess that was a bit much..
I have released a few plugins actually (More for AMX, mainly since it was around longer), but most of the ideas I think of have been done already so it is hard to find something original to release.. Also, my time constraints make it difficult to code much, so my progress on plugins is slow :( (Yes, my creative aspirations are currently limited) |
Quote:
Quote:
|
thank u xeroblood mainly(and some to avlanche) and well i have idea for u why dont u make a plugin where everyone has no clip so it becomes a no clip war but what u do is make boundaries of where they can't go... (if that is possible(i would think it is) and maybe have some other things i can't think of
thank u for the time u spent explaining it to me.. |
Glad I could help..
@Avalanche: I'm just buggin ya :P But I did say "Basically" meaning that is the basic (simple) way of it, and I didn't want to explain stuff that wasn't needed in his plugin.. :D |
Quote:
|
| All times are GMT -4. The time now is 19:27. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.