How to load a .ini file when the server starts.
#1

Hey guys, i was wondering how i could go about loading a .ini
Heres my code.

pawn Код:
CreatePayPhone(Float:XPos, Float:YPos, Float:ZPos)
{
    PhoneCount ++;
    PayPhoneInfo[PhoneCount][PhoneX] = XPos;
    PayPhoneInfo[PhoneCount][PhoneY] = YPos;
    PayPhoneInfo[PhoneCount][PhoneZ] = ZPos;
    PayPhonePickup[PhoneCount] = CreatePickup(PayPhoneObjectID, PickupType, XPos, YPos, ZPos, -1);
    return PhoneCount;
}
COMMAND:createpayphone(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new string[100],string1[100],Float:x,Float:y,Float:z;
        GetPlayerPos(playerid, x,y,z);
        format(string1,sizeof(string1),"%i",dini_Int("PayPhones.ini","amount"));
        format(string,sizeof(string),"CreatePayPhone(%d,%d,%d);",x,y,z);
        dini_Set("PayPhones.ini",string1,string);
        format(string1,sizeof(string1),"PayPhone created, a total of %i payphones have been created.",dini_Int("PayPhones.ini","amount"));
        SendClientMessage(playerid, 0xFFFFFFF,string1);
        dini_IntSet("PayPhones.ini","amount",dini_Int("PayPhones.ini","amount")+1);
        CreatePayPhone(x,y,z);
    }
    else
    {
        SendClientMessage(playerid, 0xFFFFFF,"You're not an admin.");
    }
    return 1;
}
Everything saves into the file perfectly fine in the format below.
pawn Код:
amount=12
0=CreatePayPhone(-988334941,1144270702,1108129514);
1=CreatePayPhone(-988347416,1144314919,1108344770);
2=CreatePayPhone(-988402683,1144501376,1108086784);
3=CreatePayPhone(-988377260,1144279794,1108940800);
4=CreatePayPhone(-988379952,1144256353,1108946168);
5=CreatePayPhone(-988384768,1144162005,1108303087);
6=CreatePayPhone(-988384150,1144043437,1108086784);
7=CreatePayPhone(-988298045,1144253563,1108301880);
8=CreatePayPhone(-988317700,1144131695,1108291422);
9=CreatePayPhone(-988346780,1144012484,1108298220);
10=CreatePayPhone(-988371530,1144325988,1108828150);
11=CreatePayPhone(-988356176,1144324023,1108704160);
then under OnFliterScriptInIt i need to load the payphones but i'm not sure on how it would be done.
pawn Код:
public OnFilterScriptInit()
{
        //loading here.
    return 1;
}
cheers to anybody whos willing to help out.
Reply


Messages In This Thread
How to load a .ini file when the server starts. - by Haydz - 15.01.2011, 02:04
Re: How to load a .ini file when the server starts. - by coole210 - 15.01.2011, 04:25
Re: How to load a .ini file when the server starts. - by Haydz - 15.01.2011, 04:51
Re: How to load a .ini file when the server starts. - by [L3th4l] - 15.01.2011, 05:16
Re: How to load a .ini file when the server starts. - by Haydz - 15.01.2011, 05:27
Re: How to load a .ini file when the server starts. - by [L3th4l] - 15.01.2011, 05:37
Re: How to load a .ini file when the server starts. - by Haydz - 15.01.2011, 05:49
Re: How to load a .ini file when the server starts. - by [L3th4l] - 15.01.2011, 06:04

Forum Jump:


Users browsing this thread: 1 Guest(s)