Best way to store commands
#1

What's the best way I can store commands that are loaded from a mysql database. Currently it's querying the DB when the command is processed. In the past couple days I've realised how inefficient this is. So, what's the best way to go about storing these when the server loads. I'm thinking an array, but I'm unsure how to do it.
Reply
#2

That's what I meant, I coded the commands into my GM and use mysql to store command levels. I make a query on every command to check the level, I noticed it used a high memory load when 3 - 4 people are using these commands at once. So, yes I need a way to store the command level.
Reply
#3

If I understand what your saying make a enum like this.

pawn Код:
enum User
{
      Money,
      Level
}
new pInfo[playerid][User];
Then when the player connects use sscanf to store the values collected. Once that is done you can just do something like

pawn Код:
COMMAND:cmd(playerid,params[])
{
    if(pInfo[playerid][Level] == 0)
    {
        SendClientMessage(playerid, red, "You are not a admin!");
    }
    else if(pInfo[playerid][Level] == 1)
    {
        SendClientMessage(playerid, green, "/goto, /healall");
    }
        return 1;
}
Reply
#4

yes, i recommended you YCMD too. I have used it in my gamemode and it's really good, combination with sscanf is the best
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)