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

Comand to give vip


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bbz
Junior Member
Join Date: Jan 2016
Old 09-15-2017 , 18:37   Comand to give vip
Reply With Quote #1

Hello it's possible to create a plugin like you are in-game and you insert !vip (code) example ( !vip 6HZaCT6RhH ) add add vip to user. But was random codes.
bbz is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-15-2017 , 18:46   Re: Comand to give vip
Reply With Quote #2

It's possible
__________________
Do not Private Message @me
Bacardi is offline
bbz
Junior Member
Join Date: Jan 2016
Old 09-19-2017 , 14:59   Re: Comand to give vip
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
It's possible
Can you teach me how ?
bbz is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-20-2017 , 13:34   Re: Comand to give vip
Reply With Quote #4

Quote:
Originally Posted by bbz View Post
Can you teach me how ?
Lesson one:
It is nice to request something fun things, but you should tell us more specifically.

Like now, your request leave so many open questions.
Random codes? From where? File? Random by plugin? Work once or more? Vip temporary or permament, etc. etc.






Here random example.

puplic player or admin can add himself in admin group called "vip" (you need create this group).
They just need use sm_vip command with any random text, sm_vip asdQWE123 (only letters and numbers)

But been in "vip" group is now temporary, you get removed from group after map change or by command sm_reloadadmins.
- If you want players to stay longer in vip group, this need more code.

public players get temporary adminID, when they disconnect from server, this adminID disappear from admin cache.


Simply, this vip grant works only one map.

admin_groups.cfg


PHP Code:
#include <regex>

public void OnPluginStart()
{
    
RegConsoleCmd("sm_vip"vip);
}

public 
Action vip(int clientint args)
{
    
// no console, connecting players, bots, not authorized
    
if(client == || !IsClientInGame(client) || IsFakeClient(client) || !IsClientAuthorized(client)) return Plugin_Handled;


    
GroupId group FindAdmGroup("vip");
    
// no admin group called "vip"
    
if(group == INVALID_GROUP_ID) return Plugin_Handled;



    if(
args 1)
    {
        
ReplyToCommand(client"[SM] Usage:sm_vip R4nd0mC0d3");
        return 
Plugin_Handled;
    }

    
char buffer[30];
    
GetCmdArgString(buffersizeof(buffer));


    if(
SimpleRegexMatch(buffer"[^a-zA-Z0-9]") > 0)
    {
        
ReplyToCommand(client"[SM] Random code only numbers and letters, a-z, A-Z, 0-9");
        return 
Plugin_Handled;
    }

    
AdminId admin GetUserAdmin(client);

    
// public player
    
if(admin == INVALID_ADMIN_ID)
    {
        
admin CreateAdmin("");
        
SetUserAdmin(clientadmintrue); // temporary admin
    
}


    for(
int x 0GetAdminGroupCount(admin); x++)
    {
        if(
GetAdminGroup(adminx""0) == group)
        {
            
PrintToChat(client"[SM] You already belong to group \"vip\" ");
            return 
Plugin_Handled;
        }
    }

    if(!
AdminInheritGroup(admingroup))
    {
        
LogError("!vip - invalid input or duplicate membership");
    }
    else
    {
        
LogAction(-1, -1"Player %L added to vip group."client);
        
PrintToChat(client"[SM] You have now added in \"vip\" group!");
    }

    return 
Plugin_Handled;

__________________
Do not Private Message @me
Bacardi is offline
bbz
Junior Member
Join Date: Jan 2016
Old 09-20-2017 , 13:57   Re: Comand to give vip
Reply With Quote #5

Hey, thanks for your reply

Yes, it is temporary (30 days), and the codes will be added manually maybe on a MySQL db? to all servers. One time use code, so no one can use it again.
bbz is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-20-2017 , 14:04   Re: Comand to give vip
Reply With Quote #6

...ok, I'm little busy so it could take time to me write it.
sorryyyyy
__________________
Do not Private Message @me
Bacardi is offline
Cruze
Veteran Member
Join Date: May 2017
Old 09-20-2017 , 15:22   Re: Comand to give vip
Reply With Quote #7

https://forums.alliedmods.net/showthread.php?t=292183
__________________
Taking paid private requests! Contact me
Cruze is offline
bbz
Junior Member
Join Date: Jan 2016
Old 09-20-2017 , 16:55   Re: Comand to give vip
Reply With Quote #8

Quote:
Originally Posted by Cruze View Post
And how can i do the "!vip CODE" thing ?

Thanks!
bbz is offline
Cruze
Veteran Member
Join Date: May 2017
Old 09-21-2017 , 02:45   Re: Comand to give vip
Reply With Quote #9

Code? I don't understand that
__________________
Taking paid private requests! Contact me
Cruze is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-21-2017 , 09:33   Re: Comand to give vip
Reply With Quote #10

Btw @op, are you using any other admin plugins (ex. SourceBans?) than SM basic admin system ?
__________________
Do not Private Message @me
Bacardi 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 06:02.


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