15.01.2011, 02:04
Hey guys, i was wondering how i could go about loading a .ini
Heres my code.
Everything saves into the file perfectly fine in the format below.
then under OnFliterScriptInIt i need to load the payphones but i'm not sure on how it would be done.
cheers to anybody whos willing to help out.
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;
}
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);
pawn Код:
public OnFilterScriptInit()
{
//loading here.
return 1;
}