AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Rotate Player (https://forums.alliedmods.net/showthread.php?t=5308)

Blunted1 08-27-2004 20:58

Rotate Player
 
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.

KRoT@L 08-27-2004 22:35

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 }

Blunted1 08-29-2004 01:18

Beauty thanks, much appreciated :D

I hope you didn't go to the trouble of writeing all that just for me :oops:
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 :oops:

Thanks again :D

PS just noticed out of the corner of my eye :P you used <Vexd_Utilities> :shock: over here at AMXx I believe common practice is to use the <engine> module/include instead of Vexd :wink:
No biggie, just thought I'd point it out :)

Votorx 08-29-2004 02:08

Lol, what confuses me the most is the fact that the functions he's using are the ones specified in engine, not Vexd_Unitilities.

Blunted1 08-29-2004 02:22

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 :P

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 :D

KRoT@L 08-29-2004 02:50

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 :P
And I wrote all that just for you but it wasn't a problem, I didn't have anything else to do. :wink:

Blunted1 08-29-2004 03:20

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 :P
And I wrote all that just for you but it wasn't a problem, I didn't have anything else to do. :wink:

Well then thanks twice as much :P :wink: hehe


All times are GMT -4. The time now is 17:15.

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