SA-MP Forums Archive
Saving into Dini [REP+] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Saving into Dini [REP+] (/showthread.php?tid=483868)



Saving into Dini [REP+] - Excelize - 28.12.2013

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!


Re: Saving into Dini [REP+] - rakshith122 - 28.12.2013

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.


Re: Saving into Dini [REP+] - RowdyrideR - 28.12.2013

I suggest you to use Y_ini
Easier and faster.

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


Re: Saving into Dini [REP+] - Excelize - 28.12.2013

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