AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Teleport stuck help (https://forums.alliedmods.net/showthread.php?t=22169)

Rains 12-20-2005 15:07

Teleport stuck help
 
Hello, I'm making a mod for CS, and I want to include a teleport.
The problem is, I have no idea how to check if a player is stuck, the current code is:
Code:
public blink(id)     {     if (classes[id] == 3 && skills[id][2] == 0 && mana[id]>=BLINK_COST)         {         new blinkorg[3]         new blinkorg2[3]         get_user_origin(id,blinkorg,0)         get_user_origin(id,blinkorg2,3)         if (blinkorg2[0]>=blinkorg[0])             {             blinkorg2[0] = blinkorg2[0] - 30         }         else         {             blinkorg2[0] = blinkorg2[0] + 30         }         if (blinkorg2[1]>=blinkorg[1])             {             blinkorg2[1] = blinkorg2[1] - 30         }         else         {             blinkorg2[1] = blinkorg2[1] + 30         }         blinkorg2[2] = blinkorg2[2] + 30         set_user_origin(id,blinkorg2)         mana[id] = mana[id]-BLINK_COST     }     return PLUGIN_HANDLED }

I would really appreciate help :)

WaZZeR++ 12-20-2005 16:32

maybe you can check with:
Code:
get_entity_flags(id) &FL_ONGROUND

dont know what this will return when your stuck, but it will return 0 when you are in the air. like:

Code:
while(get_entity_flags(id) &FL_ONGROUND)     origine[2]+=5

or something for the z axel

XxAvalanchexX 12-20-2005 17:30

Try this:

Code:
if( get_entity_flags(id) & FL_PARTIALGROUND )     // you are stuck

Rains 12-21-2005 10:45

Thanks, I'll try them.

EDIT:
It didn't work. Code:
Code:
 public blink(id)     {     if (classes[id] == 3 && skills[id][2] == 0 && mana[id]>=BLINK_COST)         {         new blinkorg[3]         new blinkorg2[3]         get_user_origin(id,blinkorg,0)         get_user_origin(id,blinkorg2,3)         if (blinkorg2[0]>=blinkorg[0])             {             blinkorg2[0] = blinkorg2[0] - 30         }         else         {             blinkorg2[0] = blinkorg2[0] + 30         }         if (blinkorg2[1]>=blinkorg[1])             {             blinkorg2[1] = blinkorg2[1] - 30         }         else         {             blinkorg2[1] = blinkorg2[1] + 30         }         blinkorg2[2] = blinkorg2[2] + 30         set_user_origin(id,blinkorg2)         if(get_entity_flags(id) &FL_PARTIALGROUND)         {             mana[id] = mana[id] - BLINK_COST         }         else         {             set_user_origin(id, blinkorg)         }     }     return PLUGIN_HANDLED }

XxAvalanchexX 12-21-2005 19:55

What didn't work?

Obbin 12-22-2005 05:40

look at the amx_blink plugin (teleport by sight or something)

Rains 12-22-2005 11:21

Heh, I found out an other way, thanks anyway :P

(the stuff that didn't work was: )
Code:
        if(get_entity_flags(id) &FL_PARTIALGROUND)         {             mana[id] = mana[id] - BLINK_COST         }         else         {             set_user_origin(id, blinkorg)         }


All times are GMT -4. The time now is 16:05.

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