AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hlds vs Rehlds (https://forums.alliedmods.net/showthread.php?t=328346)

Supremache 11-05-2020 17:08

Hlds vs Rehlds
 
I really didn't know they are different in scripting.
today i made simple plugin for give/take/set money and it's working on hlds but when i tested it on rehlds didn't work.
Did message mode work on rehlds or not !!???

Working only on hlds !!!!!

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <cstrike> #define PLUGIN "Gold Control" #define VERSION "0.0.1" #define AUTHOR "Supremache" new szTargetId[32]; new iGiveTarget[32]; new iSetTarget[32]; new iTakeTarget[32]; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /gold", "cmdGoldSystem")     register_clcmd("GiveAmount", "GiveAmountMessageModeHandler");     register_clcmd("SetAmount", "SetAmountMessageModeHandler");     register_clcmd("TakeAmount", "TakeAmountMessageModeHandler");     // Add your code here... } public cmdGoldSystem(id) {     new iPlayerMenu = menu_create("\yGold System\r: Choose a player", "GoldHandler");     new iPlayers[32],         iNum,         szUserID[32],         szUserName[32];         get_players(iPlayers, iNum, "ch");         for(new iPlayer, i; i < iNum; i++) {         iPlayer = iPlayers[i];         get_user_name( iPlayer, szUserName, charsmax(szUserName));         num_to_str(get_user_userid(iPlayer), szUserID, charsmax(szUserID));         menu_additem(iPlayerMenu, szUserName, szUserID);     }     menu_display(id, iPlayerMenu); } public GoldHandler(id, iPlayerMenu, iItem) {     if(iItem != MENU_EXIT) {         new iAccess,             szData[6],             szName[32],             iCallback,             iUserID,             iPlayer;         menu_item_getinfo(iPlayerMenu, iItem, iAccess, szData, charsmax(szData), szName, charsmax(szName), iCallback);                 iUserID = str_to_num( szData );         iPlayer = find_player( "k", iUserID );                 ChoosePlayer( id, iPlayer );     }     menu_destroy(iPlayerMenu);     return PLUGIN_HANDLED; } public ChoosePlayer( id, Choosen ) {     new iMainMenu,         szData[ 128 ],         szChoosen[ 5 ],         szUserName[32];         get_user_name( Choosen, szUserName, charsmax(szUserName));     formatex( szData, charsmax(szData), "Chose which option do ^nyou want to use on this player: \r%s", szUserName);     iMainMenu = menu_create( szData, "Player_Handler" );         num_to_str( Choosen, szChoosen, charsmax( szChoosen ) );            formatex(szData, charsmax(szData), "Give Golds");     menu_additem(iMainMenu, szData, szChoosen);     formatex(szData, charsmax(szData), "Set Golds");     menu_additem(iMainMenu, szData, szChoosen);     formatex(szData, charsmax(szData), "Take Golds");     menu_additem(iMainMenu, szData, szChoosen);     menu_display( id, iMainMenu );     return PLUGIN_HANDLED; } public Player_Handler(id, iPlayerMenu, iItem) {     if(iItem != MENU_EXIT) {         new iAccess, iCallBack;         menu_item_getinfo(iPlayerMenu, iItem, iAccess, szTargetId, charsmax(szTargetId), _, _, iCallBack);                 switch(iItem) {             case 0: client_cmd(id, "messagemode GiveAmount");             case 1: client_cmd(id, "messagemode SetAmount");             case 2: client_cmd(id, "messagemode TakeAmount");         }     }     menu_destroy(iPlayerMenu); } public GiveAmountMessageModeHandler(id) {     new iUserId = str_to_num(szTargetId);     iGiveTarget[id] = find_player("k", iUserId);         new szUserName[32], szTargetName[32]     if(iGiveTarget[id] && is_user_connected(iGiveTarget[id])) {         new szInput[32], iAmount;         read_argv(1, szInput, charsmax(szInput));         iAmount = str_to_num(szInput);                 if(iAmount > 0) {             cs_set_user_money(iGiveTarget[id], cs_get_user_money(iGiveTarget[id]) + iAmount);             get_user_name( id, szUserName, charsmax(szUserName));             get_user_name( iGiveTarget[id], szTargetName, charsmax(szTargetName));                         client_print( 0, print_chat, "[ADMIN] %s gave %d gold for %s", szUserName, iAmount, szTargetName)         }     } } public SetAmountMessageModeHandler(id) {     new iUserId = str_to_num(szTargetId);     iSetTarget[id] = find_player("k", iUserId);         new szUserName[32], szTargetName[32]     if(iSetTarget[id] && is_user_connected(iSetTarget[id])) {         new szInput[32], iAmount;         read_argv(1, szInput, charsmax(szInput));         iAmount = str_to_num(szInput);                 if(iAmount >= 0) {             cs_set_user_money(iSetTarget[id], iAmount);             get_user_name( id, szUserName, charsmax(szUserName));             get_user_name( iSetTarget[id], szTargetName, charsmax(szTargetName));                         client_print( 0, print_chat, "[ADMIN] %s set %d gold for %s", szUserName, iAmount, szTargetName)         }     } } public TakeAmountMessageModeHandler(id) {     new iUserId = str_to_num(szTargetId);     iTakeTarget[id] = find_player("k", iUserId);         new szUserName[32], szTargetName[32]     if(iTakeTarget[id] && is_user_connected(iTakeTarget[id])) {         new szInput[32], iAmount;         read_argv(1, szInput, charsmax(szInput));                 get_user_name( id, szUserName, charsmax(szUserName));         get_user_name( iGiveTarget[id], szTargetName, charsmax(szTargetName));         iAmount = str_to_num(szInput);                 if(iAmount > 0) {             if( iAmount >= cs_get_user_money(iTakeTarget[id]) ) {                 cs_set_user_money(iTakeTarget[id], 0);                 client_print( 0, print_chat, "[ADMIN] %s take all golds from %s", szUserName, iAmount, szTargetName)                }             else {                 cs_set_user_money(iTakeTarget[id], cs_get_user_money(iGiveTarget[id]) - iAmount);                 client_print( 0, print_chat, "[ADMIN] %s take %d gold from %s", szUserName, iAmount, szTargetName)             }         }     } }

r0ma 11-05-2020 18:43

Re: Hlds vs Rehlds
 
on rehlds try reapi rg_add_account

btw about the messagemode idk

Supremache 11-05-2020 19:05

Re: Hlds vs Rehlds
 
there's only this way to make this plugin work or i have to change style of codes ??

Mankled 11-05-2020 22:57

Re: Hlds vs Rehlds
 
Quote:

Originally Posted by Supremache (Post 2723860)
there's only this way to make this plugin work or i have to change style of codes ??

if u are steam player, valve blocked some commands to be executed by a server on a player, one of them is messagemode. why they blocked? to prevent servers from slow hacking clients.

fysiks 11-05-2020 23:08

Re: Hlds vs Rehlds
 
messagemode is a client-side concept only and has nothing to do with the server (in any direct manner). According to the list of blocked commands via cl_filterstuffcmd, it's not blocked by it.

My advice is to always just use the official HLDS.

Supremache 11-05-2020 23:10

Re: Hlds vs Rehlds
 
Quote:

Originally Posted by Mankled (Post 2723872)
if u are steam player, valve blocked some commands to be executed by a server on a player, one of them is messagemode. why they blocked? to prevent servers from slow hacking clients.

I think not because, i didn't see msg on console, as i know when i use slow hacking on steam client i get this msg in console "Server tried to send executed commands" and in this plugin i haven't got that msg !!

Supremache 11-05-2020 23:14

Re: Hlds vs Rehlds
 
Quote:

Originally Posted by fysiks (Post 2723875)
messagemode is a client-side concept only and has nothing to do with the server (in any direct manner). According to the list of blocked commands via cl_filterstuffcmd, it's not blocked by it.

My advice is to always just use the official HLDS.

So this plugin can't work on rehlds, will work only if i change that style and use another idea!

fysiks 11-05-2020 23:29

Re: Hlds vs Rehlds
 
Quote:

Originally Posted by Supremache (Post 2723879)
So this plugin can't work on rehlds, will work only if i change that style and use something another idea!

I'm not saying it won't work or what is required to make it work. I'm just telling you my opinion about HLDS vs reHLDS.

Supremache 11-05-2020 23:34

Re: Hlds vs Rehlds
 
Quote:

Originally Posted by fysiks (Post 2723880)
I'm not saying it won't work or what is required to make it work. I'm just telling you my opinion about HLDS vs reHLDS.

Well.. !

iceeedr 11-06-2020 08:05

Re: Hlds vs Rehlds
 
I think your problem is in szTarget, take this post by example.

https://forums.alliedmods.net/showpo...54&postcount=8


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

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