AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Registering CMD to client_print (https://forums.alliedmods.net/showthread.php?t=95857)

malec321 06-28-2009 03:48

[HELP] Registering CMD to client_print
 
Is this right?

register_clcmd( "say /myxp", "cmdMyxp" );
register_clcmd( "say_team /myxp", "cmdMyxp" );

public cmdMyxp
{
client_print ( id, print_chat, "Your is currently %s", iPoint )
}

if someone types /myxp


And how can i set it so that:

public Pmenu ( id )
{

new menu = menu_create ( "/rHide N Seek /yXP", "P_Menu" )

menu_additem ( menu, "\rGrenade \yMenu \r(Terrorist)", "1", 0 )
menu_additem ( menu, "\rHealth \yMenu", "2", 0 )
menu_additem ( menu, "\rArmor \yMenu" , "3", 0 )
menu_additem ( menu, "\rShop \yMenu", "4", 0 )
menu_additem ( menu, "\rBuy \yXP", "5", 0 )
menu_additem ( menu, "\rRevive - \y50 points", "6", 0 )

menu_setprop ( menu, MPROP_EXIT, MEXIT_NEVER );
menu_display (id, menu, 0 )
return PLUGIN_HANDLED;

I want it so on the menu under the title of the menu it says Your XP: %s <-- xp using iPoint

so itll look

Hide N Seek XP

Your XP: XPhere

Grenade Menu. blah blah

Arkshine 06-28-2009 04:01

Re: [HELP] Registering CMD to client_print
 
public cmdMyxp should be public cmdMyxp( id )

malec321 06-28-2009 04:05

Re: [HELP] Registering CMD to client_print
 
So basically
public cmdMyxp
{
client_print ( id, print_chat, "Your is currently %s", iPoint )
}

should be

public cmdMyxp( id )
{
client_print ( id, print_chat, "Your is currently %s", iPoint )
}

fysiks 06-28-2009 12:17

Re: [HELP] Registering CMD to client_print
 
Yes.

Also, use [php][/php] tags around any code that you post.

For you second question, use
PHP Code:

/**
 * Adds a text line to a menu.  Only available in amxmodx 1.8.1 and above.
 *
 * @param menu            Menu resource identifier.
 * @param text            Text to add.
 * @param slot            1 (default) if the line should shift the numbering down.
 *                         0 if the line should be a visual shift only.
 * @noreturn
 * @error                Invalid menu resource.
 */
native menu_addtext(menu, const text[], slot=1); 

PHP Code:

new stringvar[15]

formatex(stringvar14"Your XP: %d", <user's xp variabl here>)

menu_addtext(menu, stringvar, 0) 


xPaw 06-28-2009 18:02

Re: [HELP] Registering CMD to client_print
 
After sometests... menu_addtext hardly fails, and buttons are fucked x'D


All times are GMT -4. The time now is 15:38.

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