AlliedModders

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

irule 04-14-2024 14:12

REQ - Plugin
 
No one helped. Close pls.

fysiks 04-14-2024 18:08

Re: REQ - Plugin
 
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.

Ace67 04-19-2024 15:33

Re: REQ - Plugin
 
Quote:

Originally Posted by irule (Post 2820958)
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");



fysiks 04-20-2024 03:45

Re: REQ - Plugin
 
Quote:

Originally Posted by Ace67 (Post 2821219)
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.

mlibre 04-20-2024 23:29

Re: REQ - Plugin
 
lol epic


All times are GMT -4. The time now is 13:43.

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