AlliedModders

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

tuty 03-14-2009 13:42

HamOnControl
 
can someone help me how to use exactly hamsandwich on this plugin :arrow: http://forums.alliedmods.net/showthread.php?t=87232

i tryed some suggestions but i failed.
I'm a begginer on ham and idk exactly how to use.

fysiks 03-14-2009 15:25

Re: HamOnControl
 
I don't see anything that is Ham-able (lol).

tuty 03-14-2009 15:53

Re: HamOnControl
 
Quote:

Originally Posted by fysiks (Post 780509)
I don't see anything that is Ham-able (lol).

PHP Code:

/**
     * Description:        Not entirely sure.
     * Forward params:    function(this, idOn)
     * Return type:        Integer (boolean).
     * Execute params:    ExecuteHam(Ham_OnControls, this, idOn);
     */
    
Ham_OnControls


ConnorMcLeod 03-14-2009 16:01

Re: HamOnControl
 
PHP Code:

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHam(Ham_OnControls"func_vehicle""FuncVehicle_OnControls"1)
}

public 
FuncVehicle_OnControls(iVehicleid)
{
    
// id has taken control on iVehicle



fysiks 03-14-2009 16:17

Re: HamOnControl
 
Quote:

Originally Posted by tuty (Post 780523)
PHP Code:

/**
     * Description:        Not entirely sure.
     * Forward params:    function(this, idOn)
     * Return type:        Integer (boolean).
     * Execute params:    ExecuteHam(Ham_OnControls, this, idOn);
     */
    
Ham_OnControls


You should have put that in your first post so I wouldn't "make a fool of myself".

tuty 03-14-2009 16:20

Re: HamOnControl
 
ok, sorry about that... you are not a fool...

ConnorMcLeod 03-14-2009 16:52

Re: HamOnControl
 
Example of what you can do with Ham_OnControls and Ham_Use :
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Drive"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

/*
TRAIN_ACTIVE 128
TRAIN_NEW 192
TRAIN_OFF 0
TRAIN_NEUTRAL 1
TRAIN_SLOW 2
TRAIN_MEDIUM 3
TRAIN_FAST 4
TRAIN_BACK 5
*/
#define TRAIN_ACTIVE    0x80 
#define TRAIN_NEW        0xc0
#define TRAIN_OFF        0x00
#define TRAIN_NEUTRAL    0x01
#define TRAIN_SLOW        0x02
#define TRAIN_MEDIUM    0x03
#define TRAIN_FAST        0x04 
#define TRAIN_BACK        0x05

#define m_iTrain        350

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHam(Ham_OnControls"func_vehicle""FuncVehicle_OnControls"1)
    
RegisterHam(Ham_Use"func_vehicle""FuncVehicle_Use"1)
}

public 
FuncVehicle_OnControls(iVehicleid)
{
    
// id has taken control on iVehicle
    
new szModel[64]
    
pev(iVehiclepev_modelszModelcharsmax(szModel))
    
client_print(idprint_center"Good Drive %s :)"szModel[0] == '*' "" "on %s"szModel)
}

public 
FuncVehicle_Use(iVehicleidiCalleriUseTypeFloat:fValue)
{
    
// id is driving iVehicle

    // fValue
    //    30.0 = turning right
    //    20.0 = turning left
    //    1.0 = forward
    //    -1.0 = back
    
static szMessage[64], n
    n 
0
    
switch( fValue )
    {
        case 
20.0:+= formatex(szMessagecharsmax(szMessage), "Turning left")
        case 
30.0:+= formatex(szMessagecharsmax(szMessage), "Turning right")
    }

    switch( 
get_pdata_int(idm_iTrain5) )
    {
        case 
TRAIN_SLOW:+= formatex(szMessage[n], charsmax(szMessage)-n" Driving Slow")
        case 
TRAIN_MEDIUM:+= formatex(szMessage[n], charsmax(szMessage)-n" Driving Medium")
        case 
TRAIN_FAST:+= formatex(szMessage[n], charsmax(szMessage)-n" Driving Fast")
        case 
TRAIN_BACK:+= formatex(szMessage[n], charsmax(szMessage)-n" Driving BackWards")
    }

    
client_print(idprint_centerszMessage)




All times are GMT -4. The time now is 08:59.

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