Help with dini_IntSet
#1

i dont found an error when im compile it, but i this cmd was not working..
this is the code :
pawn Код:
if(strcmp(cmd, "/hapuskan", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /removeucp [playerid/PartOfName]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
            {
                  new file[64];
                  new name[MAX_PLAYER_NAME];
                  tmp = strtok(cmdtext, idx);
                  GetPlayerName(playerid, name, sizeof(name));
                  if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /removeucp [playername]");
                  format(file, sizeof(file),"LARP/Users/%s.ini", name); //am i wrong??
                  if(!fexist(file))
                  {
                    dini_IntSet(file, "Pending", 0); //am i wrong?
                    GetPlayerName(playerid, name, sizeof(name));
                  }
                  return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "You cant use this Commands!! (admin only)");
                return 1;
            }
        }
    }
i want set the dini_IntSet to " 0 " but, nothing happen
help me..
Reply
#2

for unban:

pawn Код:
dcmd_unban(playerid, params[])
{
    new pName[24], pFile[50], str[256], playerIP[256];
    if(PlayerInfo[playerid][pAdmin] < 1)
    {
        SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
        return true;
    }
    GetPlayerName(playerid, pName, sizeof(pName));
    format(pFile, sizeof(pFile), "LARP/Users/%s.ini", params);
    playerIP = dini_Get(pFile, "PlayerIP");
    if(!strlen(params))
    {
        SendClientMessage(playerid, COLOR_GRAD1, "Usage: /unban [playername]");
        return true;
    }
    if(!dini_Exists(pFile))
    {
        SendClientMessage(playerid, COLOR_GRAD1, "No such player found in the database.");
        return true;
    }
    format(str, sizeof str, "unbanip %s", playerIP);
    PlayerInfo[playerid][Locked] = 0;
    PlayerInfo[playerid][Banned] = 0;
    return true;
}
make sure also to edit. to it fit with your GM
Reply
#3

Quote:
Originally Posted by jonnyboy
Посмотреть сообщение
for unban:

pawn Код:
dcmd_unban(playerid, params[])
{
    new pName[24], pFile[50], str[256], playerIP[256];
    if(PlayerInfo[playerid][pAdmin] < 1)
    {
        SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
        return true;
    }
    GetPlayerName(playerid, pName, sizeof(pName));
    format(pFile, sizeof(pFile), "LARP/Users/%s.ini", params);
    playerIP = dini_Get(pFile, "PlayerIP");
    if(!strlen(params))
    {
        SendClientMessage(playerid, COLOR_GRAD1, "Usage: /unban [playername]");
        return true;
    }
    if(!dini_Exists(pFile))
    {
        SendClientMessage(playerid, COLOR_GRAD1, "No such player found in the database.");
        return true;
    }
    format(str, sizeof str, "unbanip %s", playerIP);
    PlayerInfo[playerid][Locked] = 0;
    PlayerInfo[playerid][Banned] = 0;
    return true;
}
make sure also to edit. to it fit with your GM
thanks
but i have one little question (read first post)..
Reply
#4

i don't know about that. it can be right and it can be wrong. but if its a number then it must be a "0" there. if its text then its something else
Reply
#5

Why do you check this?

pawn Код:
if(!fexist(file))
Should be like this:

pawn Код:
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /removeucp [playername]");
format(file, sizeof(file),"LARP/Users/%s.ini", name);
dini_IntSet(file, "Pending", 0);
Reply
#6

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
Why do you check this?

pawn Код:
if(!fexist(file))
Should be like this:

pawn Код:
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /removeucp [playername]");
format(file, sizeof(file),"LARP/Users/%s.ini", name);
dini_IntSet(file, "Pending", 0);
doesnt work
i want to make like this :
Pending=1
when i type /hapuskan
the Pending=0
thats what i mean...
but this is for offline player, the player's is not online..
for example the unban cmds
Reply
#7

pawn Код:
if(strcmp(cmd, "/hapuskan", true) == 0)
{
    if (PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /removeucp [playerid/PartOfName]");
            return 1;
        }
        new file[64];
        format(file, sizeof(file),"LARP/Users/%s.ini", tmp);
        if(fexist(file))
        {
            dini_IntSet(file, "Pending", 0);
            SendClientMessage(playerid, COLOR_GRAD2, "Pending=0");
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD2, "Player with that name doesn't exist!");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD2, "You cant use this Commands!! (admin only)");
    }
    return 1;
}
Reply
#8

Код:
if(strcmp(cmd, "/hapuskan", true) == 0)
{
    if (PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /removeucp [playerid/PartOfName]");
            return 1;
        }
        new file[64];
        format(file, sizeof(file),"LARP/Users/%s.ini", tmp);
        if(fexist(file))
        {
            dini_IntSet(file, "Pending", 0);
            SendClientMessage(playerid, COLOR_GRAD2, "Pending=0");
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD2, "Player with that name doesn't exist!");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD2, "You cant use this Commands!! (admin only)");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)