Saving into Dini [REP+]
#1

Hey guys

I wanted to make a Helper Rank today.

But im not sure how to save it into a Dini file..

My code:

Код:
new helper[MAX_PLAYERS];

CMD:sethelper(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
        return 0;
    new giveplayerid;
    if(sscanf(params, "u", giveplayerid))
        return SendClientMessage(playerid, red, "Usage: /sethelper [ID]");
    helper[giveplayerid] = 1;
    new string[128];
    new pName[24], aName[24];
    GetPlayerName(playerid, aName, 24);
    GetPlayerName(giveplayerid, pName, 24);
    format(string, sizeof(string), "You have made %s a helper", pName);
    SendClientMessage(playerid, blue, string);
    format(string, sizeof(string), "SERVER: Administrator %s has made you a helper", aName);
    SendClientMessage(giveplayerid, blue, string);
    return 1;
}
Help would be great!
Reply
#2

Just saying
Код:
new helper[MAX_PLAYERS];

CMD:sethelper(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
        return 0;
    new giveplayerid;
    if(sscanf(params, "u", giveplayerid))
        return SendClientMessage(playerid, red, "Usage: /sethelper [ID]");
    helper[giveplayerid] = 1;
    new string[128];
    new pName[24], aName[24];
    GetPlayerName(playerid, aName, 24);
    GetPlayerName(giveplayerid, pName, 24);
    format(string, sizeof(string), "You have made %s a helper", pName);
    SendClientMessage(playerid, blue, string);
    format(string, sizeof(string), "SERVER: Administrator %s has made you a helper", aName);
    SendClientMessage(giveplayerid, blue, string);
    return 1;
}
pInfo[id] = helper;
		   format(file, 100, ACCOUNTS_PATH, GetName(id));
		   new INI:ACCOUNT = INI_Open(file);
		   INI_WriteInt(ACCOUNT, "Helper", pInfo[id]);
		   INI_Close(ACCOUNT);
           return 1;
I'm a newbie, Trying to script slowly. So, Please don't complain me if this code is wrong..
Hope you understand,
Thanks.
Reply
#3

I suggest you to use Y_ini
Easier and faster.

https://sampforum.blast.hk/showthread.php?tid=175565
Reply
#4

Quote:
Originally Posted by rakshith122
Посмотреть сообщение
Just saying
Код:
new helper[MAX_PLAYERS];

CMD:sethelper(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
        return 0;
    new giveplayerid;
    if(sscanf(params, "u", giveplayerid))
        return SendClientMessage(playerid, red, "Usage: /sethelper [ID]");
    helper[giveplayerid] = 1;
    new string[128];
    new pName[24], aName[24];
    GetPlayerName(playerid, aName, 24);
    GetPlayerName(giveplayerid, pName, 24);
    format(string, sizeof(string), "You have made %s a helper", pName);
    SendClientMessage(playerid, blue, string);
    format(string, sizeof(string), "SERVER: Administrator %s has made you a helper", aName);
    SendClientMessage(giveplayerid, blue, string);
    return 1;
}
pInfo[id] = helper;
		   format(file, 100, ACCOUNTS_PATH, GetName(id));
		   new INI:ACCOUNT = INI_Open(file);
		   INI_WriteInt(ACCOUNT, "Helper", pInfo[id]);
		   INI_Close(ACCOUNT);
           return 1;
I'm a newbie, Trying to script slowly. So, Please don't complain me if this code is wrong..
Hope you understand,
Thanks.
Thanks for the reply, but it crashed my PAWNO xD.

Quote:

I suggest you to use Y_ini
Easier and faster.

https://sampforum.blast.hk/showthread.php?tid=175565
Thanks, ill look into it
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)