Raised This Month: $ Target: $400
 0% 

Help in editing a code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Obada
Senior Member
Join Date: Dec 2014
Location: Abu Dhabi
Old 01-09-2015 , 04:25   Help in editing a code
Reply With Quote #1

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
Obada is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-09-2015 , 18:35   Re: Help in editing a code
Reply With Quote #2

So, what is your problem then?

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

Last edited by fysiks; 01-09-2015 at 18:38.
fysiks is offline
Obada
Senior Member
Join Date: Dec 2014
Location: Abu Dhabi
Old 01-10-2015 , 02:40   Re: Help in editing a code
Reply With Quote #3

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.
Obada is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-10-2015 , 03:52   Re: Help in editing a code
Reply With Quote #4

Well, it doesn't compile so you need to fix that first.
__________________
fysiks is offline
Obada
Senior Member
Join Date: Dec 2014
Location: Abu Dhabi
Old 01-10-2015 , 08:11   Re: Help in editing a code
Reply With Quote #5

Well I'm really bad in coding. I thought I would post in the scripting help to get some help.
Obada is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-10-2015 , 15:30   Re: Help in editing a code
Reply With Quote #6

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().
__________________
fysiks is offline
Obada
Senior Member
Join Date: Dec 2014
Location: Abu Dhabi
Old 01-11-2015 , 10:38   Re: Help in editing a code
Reply With Quote #7

Wow I missed that xD

I will see and tell you if it worked.
Obada is offline
Obada
Senior Member
Join Date: Dec 2014
Location: Abu Dhabi
Old 01-12-2015 , 10:41   Re: Help in editing a code
Reply With Quote #8

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?

Last edited by Obada; 01-12-2015 at 10:42.
Obada is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 01-12-2015 , 10:55   Re: Help in editing a code
Reply With Quote #9

Quote:
Originally Posted by Obada View Post
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;
}

Last edited by Fuck For Fun; 01-12-2015 at 10:57.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Obada
Senior Member
Join Date: Dec 2014
Location: Abu Dhabi
Old 01-12-2015 , 12:45   Re: Help in editing a code
Reply With Quote #10

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

Last edited by Obada; 01-12-2015 at 12:46.
Obada is offline
Reply


Thread Tools
Display Modes

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 15:30.


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