Raised This Month: $ Target: $400
 0% 

Rotate Player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Blunted1
Senior Member
Join Date: Jun 2004
Old 08-27-2004 , 20:58   Rotate Player
Reply With Quote #1

I need to spin a player 180 degrees, any suggestions?

Sure would be nice to have a native like RotatePlayer(index, degrees), that either changes the players angle by that many degrees clockwise or
PlayerAngle(index, degrees, direction) where direction eqauls either left/right or clockwise/counter-clockwise and decides the direction of the spin.

I am sure this is possible by actually makeing the player turn, but the hope here is that the players angle will automatically be adjusted without any noticeable "spinning" animation of any kind.
Blunted1 is offline
KRoT@L
Member
Join Date: Aug 2004
Location: http://www.amxmod.net
Old 08-27-2004 , 22:35  
Reply With Quote #2

Code:
#include <amxmodx>   #include <amxmisc> #include <Vexd_Utilities> public plugin_init() {     register_plugin("Amxx Turn","1.0","KRoTaL")     register_concmd("amx_turn","admin_turn",ADMIN_LEVEL_A,"<name,id,@team,*> <degrees> <left,right>")         return PLUGIN_CONTINUE } public admin_turn(id,level,cid) {     if (!cmd_access(id,level,cid,4))         return PLUGIN_HANDLED     new arg1[32]     new arg2[32]     new arg3[32]     read_argv(1,arg1,31)     read_argv(2,arg2,31)     read_argv(3,arg3,31)     new direction=0     if(containi(arg3, "right")!=-1)         direction=0     else if(containi(arg3, "left")!=-1)         direction=1             new nbDegrees=str_to_num(arg2)     if(arg1[0] == '@')     {         new users[32], inum         get_players(users, inum, "ae", arg1[1])         if(inum == 0)         {             console_print(id, "No users in such team")             return PLUGIN_HANDLED         }         for(new i = 0; i < inum; ++i)             turn(users[i], nbDegrees, direction)         client_print(id, print_chat, "All %s's have been rotated.", arg1[1])     }     else if(arg1[0] == '*')     {             new users[32], inum             get_players(users, inum, "a")             if(inum == 0)             {                 console_print(id, "No users in such team")                 return PLUGIN_HANDLED             }             for(new i = 0; i < inum; ++i)                 turn(users[i], nbDegrees, direction)             client_print(id, print_chat, "All the players have been rotated.")     }     else     {         new player = cmd_target(id, arg1, 0)           if(!player) return PLUGIN_HANDLED                 new player_name[32]         get_user_name(player, player_name, 31)         turn(player, nbDegrees, direction)         client_print(id, print_chat, "%s has been rotated.", player_name)     }     return PLUGIN_HANDLED } public turn(player,nbDegrees,direction) {     new Float:pLook[3]     entity_get_vector(player, EV_VEC_angles, pLook)     switch(direction)     {         case 0: pLook[1]-=float(nbDegrees)         case 1: pLook[1]+=float(nbDegrees)     }     entity_set_vector(player, EV_VEC_angles, pLook)     entity_set_int(player, EV_INT_fixangle, 1)     return PLUGIN_CONTINUE }
KRoT@L is offline
Blunted1
Senior Member
Join Date: Jun 2004
Old 08-29-2004 , 01:18  
Reply With Quote #3

Beauty thanks, much appreciated

I hope you didn't go to the trouble of writeing all that just for me
I should have been more specific and said that I am writeing a plugin and need a function that will rotate a player, but this is just as good or better.... I just hope I haven't inconvienced you

Thanks again

PS just noticed out of the corner of my eye you used <Vexd_Utilities> over here at AMXx I believe common practice is to use the <engine> module/include instead of Vexd
No biggie, just thought I'd point it out
Blunted1 is offline
Votorx
Senior Member
Join Date: Jun 2004
Old 08-29-2004 , 02:08  
Reply With Quote #4

Lol, what confuses me the most is the fact that the functions he's using are the ones specified in engine, not Vexd_Unitilities.
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
Blunted1
Senior Member
Join Date: Jun 2004
Old 08-29-2004 , 02:22  
Reply With Quote #5

Quote:
Originally Posted by Votorx
Lol, what confuses me the most is the fact that the functions he's using are the ones specified in engine, not Vexd_Unitilities.
I am sure it was a quick mistake.
When I first read #include <Vexd_Utilities> I must admit I was afraid I would have to port it

But it does what it is supposed to and I can manage rewrieting it to do exactly what I need it to do pretty simply and thats whats important
Blunted1 is offline
KRoT@L
Member
Join Date: Aug 2004
Location: http://www.amxmod.net
Old 08-29-2004 , 02:50  
Reply With Quote #6

I use amx 0.9.9 so I'm used to include Vexd Utilities (and not engine), but there is a Vexd_Utilities.inc file in the include folder of amxx so why couldn't I use it
And I wrote all that just for you but it wasn't a problem, I didn't have anything else to do.
KRoT@L is offline
Blunted1
Senior Member
Join Date: Jun 2004
Old 08-29-2004 , 03:20  
Reply With Quote #7

Quote:
Originally Posted by KRoT@L
I use amx 0.9.9 so I'm used to include Vexd Utilities (and not engine), but there is a Vexd_Utilities.inc file in the include folder of amxx so why couldn't I use it
And I wrote all that just for you but it wasn't a problem, I didn't have anything else to do.
Well then thanks twice as much hehe
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 17:15.


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