Is this possible to script ?
#1

Hi guys,

I have just received a suggestion my forum for the server I'm currently scripting.
The suggestion was to buy administration.

Here is a quick brief of the what it is:

When a player impresses an administrator with any of the following:
  • Helpfulness around the server to other players.
  • Respectful to all players of the server.
  • Following all of the server rules.
This will earn them 1 administration point.

To earn administration they must first earn a total of 15 points for level 1 administration, 30 points for level 2 administration and 50 points for level 3 administration. The period of administration would last for 30-31 days.

The commands would be for the player:

/buyadmin 1-2-3 This would buy the specific level, or without the numbers to show you a dialog box.
/buylist - Shows a list of the available levels and the points they cost you.

Commands for the administrators:

/givepoint - This would give them an administration point.
/setpoint - This would only be used in cases where the player has lost his points somehow.
Reply
#2

Make it yourself, or pay someone (Yes, money) to make it for you.

This is the most I'll give you:

pawn Код:
new adminPoints[MAX_PLAYERS];
Reply
#3

Are you really gonna make /buyadmin where you buy admin with your in-game money -_-? I think that's not a good idea
Reply
#4

Alright. I decided to do it for you, all I ask in return is a thanks and rep

pawn Код:
new aPoints[MAX_PLAYERS] = 0;

public OnPlayerConnect(playerid)
{
    aPoints[MAX_PLAYERS] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    //Example for saving: (Save before setting aPoints to 0)
    if(LoggedIn[playerid] == 1) //if they aren't logged in, they dont need to be saved
    {
        new name[30];
        new str[128];
        //MYSQL:
        new query[128];
        GetPlayerName(playerid,name,sizeof(name));
        mysql_real_escape_string(name,name);
        format(query,sizeof(query),"UPDATE Accounts SET aPoints = %d WHERE Username = '%s'",aPoints[playerid],query);
        mysql_query(query);
        //or FLAT FILES:
        GetPlayerName(playerid,name,sizeof(name));
        format(str,sizeof(str),"Accounts/%s.txt",name);
        new File: fSave = fopen(str,io_write);
        format(str,sizeof(str),"aPoints=%d",aPoints(playerid));
        fwrite(fSave,str);
        fclose(fSave);
    }
    aPoints[MAX_PLAYERS] = 0;
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    //Maybe put a check for any DM and decrease admin points for bad kills?
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    //Stealing a car, bad offense? -1 aPoint
    return 1;
}

ZCMD:givepoint(playerid,params[])
{
    if(IsNotAnAdmin(playerid)) return 0;
    if(isnull(params)) return SendClientMessage(playerid,color_white,"USAGE: /givepoint (playerid)");
    new id = strval(params);
    if(id == playerid || !IsPlayerConnected(id)) return SendClientMessage(playerid,color_red,"Invalid playerid");
    aPoints[id] = aPoints[id] + 1;
    new str[128],name[2][30];
    GetPlayerName(playerid,name[0]);
    GetPlayerName(id,name[1]);
    format(str,sizeof(str),"The administrator '%s' has given you an Administrator Point.",name[0]);
    SendClientMessage(id,color_green,str);
    format(str,sizeof(str),"You have given '%s' an Administrator Point.",name[1]);
    SendClientMessage(playerid,color_green,str);
    return 1;
}
ZCMD:setpoint(playerid,params[])
{
    if(IsNotAnAdmin(playerid)) return 0;
    new id,amount;
    if(sscanf(params,"ii",id,amount)) return SendClientMessage(playerid,color_white,"USAGE: /setpoint (playerid) (point)");
    aPoints[id] = amount;
    if(id == playerid || !IsPlayerConnected(id)) return SendClientMessage(playerid,color_red,"Invalid playerid");
    new str[128],name[2][30];
    GetPlayerName(playerid,name[0]);
    GetPlayerName(id,name[1]);
    format(str,sizeof(str),"The administrator '%s' has set your Administrator Points to %d.",name[0],amount);
    SendClientMessage(id,color_red,str);
    format(str,sizeof(str),"You have set '%s' Administrator Points to %d.",name[1],amount);
    SendClientMessage(playerid,color_red,str);
    return 1;
}
ZCMD:buylevel(playerid,params[])
{
    if(IsNotAnAdmin(playerid)) return 0;
    if(isnull(params)) return SendClientMessage(playerid,color_white,"USAGE: /givepoint (playerid)");
    new level = strval(params);
    if(Admin[playerid] >= level || Admin[playerid] <= level) return SendClientMessage(playerid,color_red,"Invalid level.");
    if(level < 1 || level > 3) return SendClientMessage(playerid,color_red,"Invalid level.");
    if(level == 1 && aPoints[playerid] < 15) return SendClientMessage(playerid,color_red,"Not enough points!");
    if(level == 2 && aPoints[playerid] < 30) return SendClientMessage(playerid,color_red,"Not enough points!");
    if(level == 3 && aPoints[playerid] < 50) return SendClientMessage(playerid,color_red,"Not enough points!");
    switch(level)
    {
        case 1:
        {
            aPoints[playerid] = aPoints[playerid] - 15;
        }
        case 2:
        {
            aPoints[playerid] = aPoints[playerid] - 30;
        }
        case 3:
        {
            aPoints[playerid] = aPoints[playerid] - 50;
        }
    }
    Admin[playerid] = level;
    new str[128];
    format(str,sizeof(str),"You have bought the admin level %d for 30 days, congratulations.",level);
    SendClientMessage(id,color_green,str);
    TempAdmin[playerid] = getdate();+30//check on logins if the date is equal to or over this variable (save it)
    return 1;
}
Reply
#5

The admins could just give themselves more points.
Reply
#6

Well this is for my server and no the administrators would not be tampering with this. If they did and I was too come online or check the server database and see that their level did not match the one I had initially set for them, then there would be serious consequences. But thanks for pointing that out, I will have to check it regularly.
Reply
#7

Quote:
Originally Posted by coole210
Посмотреть сообщение
Alright. I decided to do it for you, all I ask in return is a thanks and rep

pawn Код:
new aPoints[MAX_PLAYERS] = 0;

public OnPlayerConnect(playerid)
{
    aPoints[MAX_PLAYERS] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    //Example for saving: (Save before setting aPoints to 0)
    if(LoggedIn[playerid] == 1) //if they aren't logged in, they dont need to be saved
    {
        new name[30];
        new str[128];
        //MYSQL:
        new query[128];
        GetPlayerName(playerid,name,sizeof(name));
        mysql_real_escape_string(name,name);
        format(query,sizeof(query),"UPDATE Accounts SET aPoints = %d WHERE Username = '%s'",aPoints[playerid],query);
        mysql_query(query);
        //or FLAT FILES:
        GetPlayerName(playerid,name,sizeof(name));
        format(str,sizeof(str),"Accounts/%s.txt",name);
        new File: fSave = fopen(str,io_write);
        format(str,sizeof(str),"aPoints=%d",aPoints(playerid));
        fwrite(fSave,str);
        fclose(fSave);
    }
    aPoints[MAX_PLAYERS] = 0;
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    //Maybe put a check for any DM and decrease admin points for bad kills?
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    //Stealing a car, bad offense? -1 aPoint
    return 1;
}

ZCMD:givepoint(playerid,params[])
{
    if(IsNotAnAdmin(playerid)) return 0;
    if(isnull(params)) return SendClientMessage(playerid,color_white,"USAGE: /givepoint (playerid)");
    new id = strval(params);
    if(id == playerid || !IsPlayerConnected(id)) return SendClientMessage(playerid,color_red,"Invalid playerid");
    aPoints[id] = aPoints[id] + 1;
    new str[128],name[2][30];
    GetPlayerName(playerid,name[0]);
    GetPlayerName(id,name[1]);
    format(str,sizeof(str),"The administrator '%s' has given you an Administrator Point.",name[0]);
    SendClientMessage(id,color_green,str);
    format(str,sizeof(str),"You have given '%s' an Administrator Point.",name[1]);
    SendClientMessage(playerid,color_green,str);
    return 1;
}
ZCMD:setpoint(playerid,params[])
{
    if(IsNotAnAdmin(playerid)) return 0;
    new id,amount;
    if(sscanf(params,"ii",id,amount)) return SendClientMessage(playerid,color_white,"USAGE: /setpoint (playerid) (point)");
    aPoints[id] = amount;
    if(id == playerid || !IsPlayerConnected(id)) return SendClientMessage(playerid,color_red,"Invalid playerid");
    new str[128],name[2][30];
    GetPlayerName(playerid,name[0]);
    GetPlayerName(id,name[1]);
    format(str,sizeof(str),"The administrator '%s' has set your Administrator Points to %d.",name[0],amount);
    SendClientMessage(id,color_red,str);
    format(str,sizeof(str),"You have set '%s' Administrator Points to %d.",name[1],amount);
    SendClientMessage(playerid,color_red,str);
    return 1;
}
ZCMD:buylevel(playerid,params[])
{
    if(IsNotAnAdmin(playerid)) return 0;
    if(isnull(params)) return SendClientMessage(playerid,color_white,"USAGE: /givepoint (playerid)");
    new level = strval(params);
    if(Admin[playerid] >= level || Admin[playerid] <= level) return SendClientMessage(playerid,color_red,"Invalid level.");
    if(level < 1 || level > 3) return SendClientMessage(playerid,color_red,"Invalid level.");
    if(level == 1 && aPoints[playerid] < 15) return SendClientMessage(playerid,color_red,"Not enough points!");
    if(level == 2 && aPoints[playerid] < 30) return SendClientMessage(playerid,color_red,"Not enough points!");
    if(level == 3 && aPoints[playerid] < 50) return SendClientMessage(playerid,color_red,"Not enough points!");
    switch(level)
    {
        case 1:
        {
            aPoints[playerid] = aPoints[playerid] - 15;
        }
        case 2:
        {
            aPoints[playerid] = aPoints[playerid] - 30;
        }
        case 3:
        {
            aPoints[playerid] = aPoints[playerid] - 50;
        }
    }
    Admin[playerid] = level;
    new str[128];
    format(str,sizeof(str),"You have bought the admin level %d for 30 days, congratulations.",level);
    SendClientMessage(id,color_green,str);
    TempAdmin[playerid] = getdate();+30//check on logins if the date is equal to or over this variable (save it)
    return 1;
}
If I give you my MSN or Skype, can I send you my Admin script and add this script to it ?
Reply
#8

*Bump
Reply
#9

Lmfao, Worst Idea,

Admin is a Duty, not Somthing you Get Given.
Its a Job/Duty, to Look after the Server, so Shit Dont Get Out of Hand.

Cheers
Ezay
\o/
Reply
#10

Yea, this seems like a pretty bad idea.
Like, you don't want some random ass being in your admin team.

You could script it like when the player helps someone out, the one who got helper types '/helpedme [ID]'.
And that would earn them points.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)