Raised This Month: $51 Target: $400
 12% 

REQ - Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
irule
Junior Member
Join Date: Mar 2024
Old 04-14-2024 , 14:12   REQ - Plugin
Reply With Quote #1

Hi, this plugin is when im dead or spectator it show players info like in pic so i try this format code "formatex" but not work any simple script or idea thanks.


Code:
public show_spectator(id) {     static iLen, szMenu[512], iKeys;         iKeys = ( MENU_KEY_0 | MENU_KEY_1 | MENU_KEY_2 );         iLen = formatex(szMenu, sizeof(szMenu) - 1, "\r* \wSpectator List:^n^n",)     iLen += formatex(szMenu[iLen], sizeof(szMenu) - 1 - iLen, "\r*\w Name: ^n", get_user_name(id)) // Example     iLen += formatex(szMenu[iLen], sizeof(szMenu) - 1 - iLen, "\r*\w Rank: ^n")     iLen += formatex(szMenu[iLen], sizeof(szMenu) - 1 - iLen, "\r*\w Played time:^n")     iLen += formatex(szMenu[iLen], sizeof(szMenu) - 1 - iLen, "\r*\w Contact with owners!^n")         iLen += formatex(szMenu[iLen], sizeof(szMenu) - 1 - iLen, "^n\r0. \wExit");         show_menu(id, iKeys, szMenu, -1, "Test Spectator"); }


These codes are useless:
Code:
1 - iKeys = ( MENU_KEY_0 | MENU_KEY_1 | MENU_KEY_2 ); 2 - iLen += formatex(szMenu[iLen], sizeof(szMenu) - 1 - iLen, "^n\r0. \wExit");
Attached Thumbnails
Click image for larger version

Name:	Screenshot 2024-04-14 195537.png
Views:	75
Size:	24.6 KB
ID:	204098  
irule is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-14-2024 , 18:08   Re: REQ - Plugin
Reply With Quote #2

You may think they are useless but that is because you're not doing it correctly. You need to learn some basics about AMX Mod X scripting. For example, get_user_name() doesn't work like that. You need to use it properly to get a string from it and then use the variable containing the string in the formatex() function. You also need to learn how formatting strings work to get the provided variables into the string.

If you really want to use the original menu method, you should find plugins that already use it properly and base your code off of that (many of the built-in AMX Mod X plugins use this method). This goes for other things as well, learn how to use the functions properly like get_user_name().

If you have further specific questions, please post those specific questions.
__________________
fysiks is offline
Ace67
Senior Member
Join Date: Sep 2020
Location: France
Old 04-19-2024 , 15:33   Re: REQ - Plugin
Reply With Quote #3

Quote:
Originally Posted by irule View Post
Hi, this plugin is when im dead or spectator it show players info like in pic so i try this format code "formatex" but not work any simple script or idea thanks.


Code:
public show_spectator(id) {     static iLen, szMenu[512], iKeys;         iKeys = ( MENU_KEY_0 | MENU_KEY_1 | MENU_KEY_2 );         iLen = formatex(szMenu, sizeof(szMenu) - 1, "\r* \wSpectator List:^n^n",)     iLen += formatex(szMenu[iLen], sizeof(szMenu) - 1 - iLen, "\r*\w Name: ^n", get_user_name(id)) // Example     iLen += formatex(szMenu[iLen], sizeof(szMenu) - 1 - iLen, "\r*\w Rank: ^n")     iLen += formatex(szMenu[iLen], sizeof(szMenu) - 1 - iLen, "\r*\w Played time:^n")     iLen += formatex(szMenu[iLen], sizeof(szMenu) - 1 - iLen, "\r*\w Contact with owners!^n")         iLen += formatex(szMenu[iLen], sizeof(szMenu) - 1 - iLen, "^n\r0. \wExit");         show_menu(id, iKeys, szMenu, -1, "Test Spectator"); }


These codes are useless:
Code:
1 - iKeys = ( MENU_KEY_0 | MENU_KEY_1 | MENU_KEY_2 ); 2 - iLen += formatex(szMenu[iLen], sizeof(szMenu) - 1 - iLen, "^n\r0. \wExit");
Hello, I updated it for you, since I had time after school.

If it doesn't work let me know, i'll help you back.

PHP Code:
public show_spectator(id)
{
    static 
iLenszMenu[512], iKeys;
    
    
iKeys = (MENU_KEY_0 MENU_KEY_1 MENU_KEY_2);
    
    
iLen formatex(szMenusizeof(szMenu) - 1"\r* \wSpectator List:^n^n");
    
iLen += formatex(szMenu iLensizeof(szMenu) - iLen"\r*\w Name: ^n%s"get_user_name(id)); // Example
    
iLen += formatex(szMenu iLensizeof(szMenu) - iLen"\r*\w Rank: ^n%s""SomeRank");
    
iLen += formatex(szMenu iLensizeof(szMenu) - iLen"\r*\w Played time:^n%s""SomeTime");
    
iLen += formatex(szMenu iLensizeof(szMenu) - iLen"\r*\w Contact with owners!^n");
    
    
iLen += formatex(szMenu iLensizeof(szMenu) - iLen"^n\r0. \wExit");
    
    
show_menu(idiKeysszMenu, -1"Test Spectator");

__________________
CS:CZ > CS 1.6
Ace67 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-20-2024 , 03:45   Re: REQ - Plugin
Reply With Quote #4

Quote:
Originally Posted by Ace67 View Post
Hello, I updated it for you, since I had time after school.

If it doesn't work let me know, i'll help you back.
It seems you too need to learn some basics of AMX Mod X, specifically how strings and get_user_name() works.
__________________
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:55.


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