AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help in editing a code (https://forums.alliedmods.net/showthread.php?t=254988)

Obada 01-09-2015 04:25

Help in editing a code
 
Hey there.

I'm trying to edit the plugin adminvote.sma, so basically what I want it to do is if staff member of the server made a vote and everybody voted, at last he/she will be asked to continue, if he/she declined, then there's a message will be printed saying Result Refused, and if he/she accepted, a message will be printed saying Result accepted.


So what I'm trying to do is when an admin makes a vote and he/she want's to continue, It will say

Result Accepted by Administrator %s

and if he/she wants to decline, it would say

Result Refused by Administrator %s


But the problem is I have an 2 extra staff ranks which are Golden and Silver Players.

and if they accepted or decline a vote, it would say

Result Accepted/Refused by GP/SP %s, %s should be the name of the staff member.


Here what I tried.

PHP Code:

public actionResult(idkey)
{
    
remove_task(4545454)
    
    switch (
key)
    {
        case 
0:
        {
            
set_task(2.0"delayedExec"0g_Executeg_execLen)
            
log_amx("Vote: %L""en""RES_ACCEPTED")
            
            if(
get_user_flags(id) & SILVER)
                    
client_print(0print_chat"%L"LANG_PLAYER"RES_ACCEPTED_S1")
        
            else if(
get_user_flags(id) & ADMIN)
                    
client_print(0print_chat"%L"LANG_PLAYER"RES_ACCEPTED_A1")
        
            else if(
get_user_flags(id) & GOLDEN)
                    
client_print(0print_chat"%L"LANG_PLAYER"RES_ACCEPTED"_G1)
        }
        case 
1autoRefuse()
    }
    
    return 
PLUGIN_HANDLED


Thank you

fysiks 01-09-2015 18:35

Re: Help in editing a code
 
So, what is your problem then?

I do see one error in a string for the multilingual system.

Obada 01-10-2015 02:40

Re: Help in editing a code
 
What I want is when a Golden Player accepts a result, it would say result accepted by Golden Player %s.

It doesn't at the moment.

fysiks 01-10-2015 03:52

Re: Help in editing a code
 
Well, it doesn't compile so you need to fix that first.

Obada 01-10-2015 08:11

Re: Help in editing a code
 
Well I'm really bad in coding. I thought I would post in the scripting help to get some help.

fysiks 01-10-2015 15:30

Re: Help in editing a code
 
Well, are you able to get it to compile? You said it doesn't show the message when you accept/refuse a result. This implies that you have the plugin running in your server. However, that means that you have different code in your plugin than you posted.

If you post that "this plugin doesn't work" we can't really help you. You need to tell us what is wrong, specifically. So, if you are able to compile it, I don't see anything wrong with it. But, like I said, the code that you posted will NOT compile because of one of the strings you are providing for the multilingual system. Check the third client_print().

Obada 01-11-2015 10:38

Re: Help in editing a code
 
Wow I missed that xD

I will see and tell you if it worked.

Obada 01-12-2015 10:41

Re: Help in editing a code
 
Btw if I want the name of the player to be printed, it should be like that?
PHP Code:

client_print(0print_chat"%L"LANG_PLAYER"RES_ACCEPTED_G1"name

I should add "name", right?

Fuck For Fun 01-12-2015 10:55

Re: Help in editing a code
 
Quote:

Originally Posted by Obada (Post 2248254)
Btw if I want the name of the player to be printed, it should be like that?
PHP Code:

client_print(0print_chat"%L"LANG_PLAYER"RES_ACCEPTED_G1"name

I should add "name", right?

-->
Code:

client_print(0, print_chat, "%L %s", LANG_PLAYER, "RES_ACCEPTED_G1", GetUserName( id ))
Code:

stock GetUserName( const index )
{
    static szName[ 32 ];
   
    get_user_name( index, szName, charsmax( szName ) );
   
    return szName;
}

:fox:

Obada 01-12-2015 12:45

Re: Help in editing a code
 
Thanks man.

one more question.

I use this in plmenu.sma, when an Admin Slap/Slay, it shows that administartor has slapped.

but when a Golden Player/Silver Player slaps, it doesn't show anything.

PHP Code:

log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^""nameget_user_userid(id), authidg_menuSettings[id], name2get_user_userid(player), authid2)
                
                if(
get_user_flags(id) & ADMIN)
                        
show_activity_key("ADMIN_SLAP_1""ADMIN_SLAP_2"namename2g_menuSettings[id]);
        
                else if(
get_user_flags(id) & SILVER)
                        
show_activity_key("SILVER_SLAP_1""SILVER_SLAP_2"namename2g_menuSettings[id]);
        
                else if(
get_user_flags(id) & GOLDEN)
                        
show_activity_key("GOLDEN_SLAP_1""GOLDEN_SLAP_2"namename2g_menuSettings[id]);

            } else {
                
log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^""nameget_user_userid(id), authidname2get_user_userid(player), authid2)
                
                if(
get_user_flags(id) & ADMIN)
                        
show_activity_key("ADMIN_SLAY_1""ADMIN_SLAY_2"namename2);
        
                else if(
get_user_flags(id) & SILVER)
                        
show_activity_key("SILVER_SLAY_1""SILVER_SLAY_2"namename2);
        
                else if(
get_user_flags(id) & GOLDEN)
                        
show_activity_key("GOLDEN_SLAY_1""GOLDEN_SLAY_2"namename2);
            } 

the plmenu.txt is right, there is no missing text there.



And where to add the stock that you gave me? Directly after it or at the end of the code?

Sorry for my noobness, still learning. :s


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

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