AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Speed and menu (https://forums.alliedmods.net/showthread.php?t=120516)

fixed 03-05-2010 15:34

Speed and menu
 
How to get a player extra speed?
And I dont understand the menu system. Example menu:

1. Get speed

and all that...
When u press 1 you shall get extra speed?

Please help!

wrecked_ 03-05-2010 15:48

Re: Speed and menu
 
https://forums.alliedmods.net/showthread.php?t=46364

Code:
// plugin shit public CMD_Menu( id ) {     new menu = menu_create( "Your Menu Name", "func_handler" )         menu_additem( menu, "Speed", "1", 0 ) // menu id, option, data, access     menu_additem( menu, "Other", "2", 0 )         menu_setprop( menu, MPROP_EXIT, MEXIT_ALL ) // adding exit         menu_display( id, menu, 0 ) // p index, menu id, page         return PLUGIN_CONTINUE; } public func_handler( id, menu, item ) {     if( item == MENU_EXIT )     {         menu_destroy( menu )                 return PLUGIN_HANDLED;     }         new access, callback, name[64], data[6]         menu_item_getinfo( menu, item, access, data, 5, name, 63, callback )         new choice = str_to_num( data )         switch( choice )     {         case 1: // Speed         {             // Method of setting speed for id         }                 case 2: // Other         {             // ...         }         // ...     }         menu_destroy( menu )         return PLUGIN_HANDLED; }

fixed 03-05-2010 15:54

Re: Speed and menu
 
awesome thanks dude now I just need the speed :)

wrecked_ 03-05-2010 16:07

Re: Speed and menu
 
PHP Code:

set_pevidpev_maxspeed300.0 // must be float, fakemeta way
// or
set_user_maxspeedid300.0 // same, fun way 


fixed 03-05-2010 16:17

Re: Speed and menu
 
Thanks, but I cant get this menu to work. Im more familiar to the new menu "generator like" :P

PHP Code:

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /selectitem""func_handler")

    new 
menu menu_create"Your Menu Name""func_handler" )
    
    
menu_additemmenu"Speed""1"// menu id, option, data, access
    
menu_additemmenu"Other""2")
    
    
menu_setpropmenuMPROP_EXITMEXIT_ALL // adding exit
    
    
menu_displayidmenu// p index, menu id, page
    
    
return PLUGIN_CONTINUE;
}


public 
func_handleridmenuitem )
{

    
    
    if( 
item == MENU_EXIT )
    {
        
menu_destroymenu )
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
accesscallbackname[64], data[6]
    
    
menu_item_getinfomenuitemaccessdata5name63callback )
    
    new 
choice str_to_numdata )
    
    switch( 
choice )
    {
        case 
1// Speed
        
{

        }
        
        case 
2// Other
        
{
            
// ...
        
}
        
// ...
    
}
    
    
menu_destroymenu )
    
    return 
PLUGIN_HANDLED;


It says error, and it dosent work with the other code :S

wrecked_ 03-05-2010 16:24

Re: Speed and menu
 
What error?

fixed 03-05-2010 16:31

Re: Speed and menu
 
menu_display( id, menu, 0 ) // p index, menu id, page

this line!

ID error and its says that it dosent have any effect :S

wrecked_ 03-05-2010 16:38

Re: Speed and menu
 
Oh, that's because you have the display in plugin_init which has no player id stored.

Display the menu in a different function that has a player id stored.

fixed 03-05-2010 16:43

Re: Speed and menu
 
Thanks works now :D

EDIT:
What is the command for give weapons like smoke grenade?

wrecked_ 03-05-2010 16:46

Re: Speed and menu
 
PHP Code:

give_itemid"weapon_smokegrenade" 



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

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