AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Noclip-invisible/Tasking help (https://forums.alliedmods.net/showthread.php?t=28495)

Fred Dawes 05-15-2006 22:48

Noclip-invisible/Tasking help
 
I am working on making passenger mod for carmod (so sue me) and I have run into a few problems.

I want the effect to be when you type passenger (and are looking at a person inside a car), You are invisible, nocliped, and constantly teleported to their location +9 on the Z axis. When you type passenger again, you are teleported on their heads and stop the teleporting. This is what I have so far.

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fun> ---------------------- public getin(id){     new blah2     if(get_user_aiming(id,carpool[id],blah2,200)) {         if(carpooled[id] == 1)             {             getout(id)             return PLUGIN_HANDLED;         }         if(incar[id] == 1){             if(carpooled[carpool[id]] == 1){                 client_print(carpool[id],print_chat,"[CarMod] You got kicked out of the car!")                 getout(carpool[id])             }else{                 client_print(id,print_chat,"[CarMod] Get out of your car first!")             }         }         if(!is_user_connected(carpool[id]))             {             client_print(id,print_chat,"[CarMod] Invalid target.")             return PLUGIN_HANDLED;         }         if(incar[carpool[id]] == 0)             {             client_print(id,print_chat,"[CarMod] Player not in car.")             return PLUGIN_HANDLED;         }         client_print(id,print_chat,"[CarMod] You are now riding with the player!")         set_user_rendering(id,kRenderFxNone,0,0,0,kRenderTransAlpha,0)         set_user_noclip(id, 1)         get_user_origin(carpool[id], torigin[id])         torigin[id][2] += 80         carpooled[id] = 1         set_user_origin(id,torigin[id])         set_task(0.1, "originchange", id+45, "", 0, "b")         return PLUGIN_HANDLED     } else {         client_print(id,print_chat,"[CarMod] Too far away to ride the player's car.")         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED; } public originchange(id){     id -= 45     if(carpool[id] == 0)         {         getout(id)         remove_task(id+45)         return PLUGIN_HANDLED;     }     get_user_origin(carpool[id], torigin[id])     torigin[id][2] += 0         set_user_origin(id,torigin[id])     return PLUGIN_HANDLED; } public getout(id) {     carpool[id] = 0     client_print(id,print_chat,"[CarMod] You are no longer incar with the player!")     set_user_noclip(id,0)     set_user_rendering(id,kRenderFxNone,0,0,0,kRenderTransAlpha,255)     get_user_origin(carpool[id], torigin[id])     torigin[id][2] += 80     set_user_origin(id,torigin[id])     remove_task(id+45)     set_task(3.0,"leavecar",id)     return PLUGIN_HANDLED; } public leavecar(id) {     carpooled[id] = 0     return PLUGIN_HANDLED }

The effect is I am not nocliped nor invisible while passengering.

When I leave, I am teleported above the driver's head, but I constantly am flooded with

[CarMod] You are no longer incar with the player!

Is there any way I can fix this problem?

SubStream 05-16-2006 18:02

If you are no-clipped then it will not be able to recognize you are in the car so no you cannot fix it easily. You would have to get coordinates for the car and check if you are within a certain area around those coordinates if you are noclipped.


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

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