AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Is it possible to force client to sleep. (https://forums.alliedmods.net/showthread.php?t=98987)

ƒa†es™ 07-31-2009 12:11

Is it possible to force client to sleep.
 
Is it possible to force client to sleep.
Like someone walk into the trap that i plant on the floor.

When he step on the trap he will be fade to black + can't move after few second return to normal ?

Arkshine 07-31-2009 12:42

Re: Is it possible to force client to sleep.
 
Yes it's possible.

Alucard^ 07-31-2009 14:27

Re: Is it possible to force client to sleep.
 
This maybe can help you to freeze a player:

http://forums.alliedmods.net/showthread.php?t=81608
http://forums.alliedmods.net/showthread.php?t=29450

This maybe can help you to get origins to do the trap:

PHP Code:

#include <amxmodx>
#include <fakemeta>

#define PLUGIN    "Get angles & origin"
#define AUTHOR    "Alucard"
#define VERSION    "2.0"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /origin""get_origin")
    
register_clcmd("say /angles""get_angles")
    
register_clcmd("say /vangles""get_vangles")
    
register_clcmd("say /getmenu""get_menu")
}

public 
get_menu(id)
{
    new 
menu menu_create("\yGet Menu:""get_show")
    
    
menu_additem(menu"\wOrigin""1"0)
    
menu_additem(menu"\wAngles""2"0)
    
menu_additem(menu"\wV Angles""3"0)
    
    
menu_setprop(menu,MPROP_EXITNAME,"Salir")
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
    
menu_display(idmenu0
    return 
PLUGIN_HANDLED
}

public 
get_show(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iData[6]
    new 
iAccess
    
new iCallback
    
new iName[64]
    
    
menu_item_getinfo(menuitemiAccessiData5iName63iCallback)
    
    switch(
str_to_num(iData))
    {
        case 
1:
        {
            
get_origin(id)
            
menu_display(idmenu0)
        }
        case 
2:
        {
            
get_angles(id)
            
menu_display(idmenu0)
        }
        case 
3:
        {
            
get_vangles(id)
            
menu_display(idmenu0)
        }
    }
    return 
PLUGIN_HANDLED
}

public 
get_origin(id)
{
    new 
Float:fOrigin[3]
    
pev(id pev_origin fOrigin)
    
client_print(idprint_chat"origin: %f, %f, %f"fOrigin[0], fOrigin[1], fOrigin[2])
    return 
PLUGIN_HANDLED
}

public 
get_angles(id)
{
    new 
Float:fAngles[3]
    
pev(id pev_angles fAngles)
    
client_print(idprint_chat"angles: %f, %f, %f"fAngles[0], fAngles[1], fAngles[2])
    return 
PLUGIN_HANDLED
}

public 
get_vangles(id)
{
    new 
Float:fVAngles[3]
    
pev(id pev_v_angle fVAngles)
    
client_print(idprint_chat"v_angles: %f, %f, %f"fVAngles[0], fVAngles[1], fVAngles[2])
    return 
PLUGIN_HANDLED


And this maybe can help you to do a fade to black:

PHP Code:

stock Fade(id,red,green,blue,alpha)
{
    
message_begin(MSG_ONE,g_fade,{0,0,0},id)
    
write_short(1<<10)
    
write_short(1<<10)
    
write_short(1<<12)
    
write_byte(red)
    
write_byte(green)
    
write_byte(blue)
    
write_byte(alpha)
    
message_end()



ƒa†es™ 07-31-2009 21:59

Re: Is it possible to force client to sleep.
 
How do i make a plugin that can plant a trap when a person step into my trap he will fade to black + can't move for some second ?

After seeing your codes i still don't understand. :(

Alucard^ 07-31-2009 23:10

Re: Is it possible to force client to sleep.
 
Quote:

Originally Posted by ƒa†es™ (Post 887136)
How do i make a plugin that can plant a trap when a person step into my trap he will fade to black + can't move for some second ?

After seeing your codes i still don't understand. :(

What you dont understand?

About the Get angles & origin utilitie... you dont have to understand the code.. use the plugin to get the origin of a position in a map (/getmenu) and then you can set the origin to the trap, but to do the trap you have to create an entity (i think), and if you dont understand this code you cant do a "trap" cuz that is more advanced... maybe try to see the code in blockmaker plugins.

About screenfade, well.. here an example:

PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN    "Fade Example"
#define AUTHOR    "Alucard"
#define VERSION    "1.0"

new g_fade

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_fade get_user_msgid("ScreenFade")
    
    
register_clcmd("say /fademe""FadeHandler")
}

public 
FadeHandler(id)
{
    
Fade(id,255,0,0,20)
}

stock Fade(id,red,green,blue,alpha)
{
    
message_begin(MSG_ONE,g_fade,{0,0,0},id)
    
write_short(1<<10)
    
write_short(1<<10)
    
write_short(1<<12)
    
write_byte(red)
    
write_byte(green)
    
write_byte(blue)
    
write_byte(alpha)
    
message_end()


I know this plugin work but maybe should be:

PHP Code:

public FadeHandler(id)
{
    
message_begin(MSG_ONE,g_fade,{0,0,0},id)
    
write_short(1<<10)
    
write_short(1<<10)
    
write_short(1<<12)
    
write_byte(255//red
    
write_byte(0//green
    
write_byte(0//blue
    
write_byte(20//alpha
    
message_end()


But i am not sure if using the stock is better or not.

IneedHelp 08-01-2009 00:09

Re: Is it possible to force client to sleep.
 
You can check if the player touchs that "trap" (Ham_Touch?!) and then make him "sleep"


All times are GMT -4. The time now is 18:26.

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