Help. :|
#1

Hello. So, I made this.

pawn Код:
new INI:File = INI_Open(HousePath());
INI_SetTag(File,"Houses");
INI_WriteInt(File,"House ID", hID);
INI_WriteInt(File,"House Interior", hInterior);
INI_WriteFloat(File,"hX", X);
INI_WriteFloat(File,"hY", Y);
INI_WriteFloat(File,"hZ", Z);
But, when I enter in game, use command, works fine, but when I enter on folder.... there isn't nothing.

Look here path.

pawn Код:
stock HousePath()
{
    new string[128];
    format(string,sizeof(string),PATH, Houses);
    return string;
}
And define:

pawn Код:
#define PATH "/Houses/%d.ini"
where '%d' it's house id. When I made command, I put:

pawn Код:
Houses++;
And at the top of script:

pawn Код:
new Houses;
Where it's the problem, because I can't see nothing in .ini file of that house?

+Rep for helper
Reply
#2

pawn Код:
public SaveHouses()
Do you even load or save anything ?
Reply
#3

Of course I do, this isn't what I asked. Yesterday I made something like this, and worked fine. Now, I changed him from Pick-up Creator, in House Creator, but now, doesn't work.
Reply
#4

pawn Код:
new INI:File = INI_Open(HousePath(/*put your house id here for example "i" in loop*/));
INI_SetTag(File,"Houses");
INI_WriteInt(File,"House ID", hID);
INI_WriteInt(File,"House Interior", hInterior);
INI_WriteFloat(File,"hX", X);
INI_WriteFloat(File,"hY", Y);
INI_WriteFloat(File,"hZ", Z);

stock HousePath(houseid /*you have to call something :|*/)
{
    new string[128];
    format(string,sizeof(string),PATH, houseid /* <-----------*/);
    return string;
}
Reply
#5

Someone, who really can help me? I said, and I said, I did this yesterday, and works fine. So I don't need to call nothing.
Reply
#6

I don't even know what you are trying to say.
Reply
#7

!!!
read format function on wiki bro !!

your path define is: #define PATH "/Houses/%d.ini"
and what is %d ??

its an integer right ??

and when you use format(string,sizeof(string),PATH, Houses); you actually put "Houses" instead of %d

in this stock

pawn Код:
stock HousePath()
{
    new string[128];
    format(string,sizeof(string),PATH, Houses);
    return string;
}
tell me what is "Houses" ??

how you set "Houses" variable value ?!

yesterday you did somting like this:

pawn Код:
stock HousePath()
{
    new string[128], Houses;
    for(new Houses = 0; Houses < 500; Houses++)
    {
    format(string,sizeof(string),PATH, Houses);
    return string;
    }
}
but its beter that use that way i told you above
Reply
#8

Anyway, now I started from 0 with Pickups:

pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf>
#include <YSI\y_ini>

#define PATH "/Pickups/%d.ini"

enum pInfo
{
    Float:pX,
    Float:pY,
    Float:pZ,
    pID,
}
new Pick[MAX_PLAYERS][pInfo];
new pickups;

public OnPlayerConnect(playerid)
{
   INI_ParseFile(PickPath(pickups), "LoadPickup_%s", .bExtra = true, .extra = playerid);
   return 1;
}
CMD:createpick(playerid, params[])
{
    new Pickup, string[128], Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if(sscanf(params,"i", Pickup)) return SendClientMessage(playerid, -1, "{FFCC33}USAGE: {15FF00}/CreatePick [Pick-up ID]");
    format(string, sizeof(string), "{FFCC33}Pick-up {FF0000}%d {FFCC33}|| Pick-up ID: {FF0000}%i {FFCC33}was created.", pickups, Pickup);
    SendClientMessage(playerid, -1, string);
    pickups++;
    CreatePickup(Pickup, 1, X, Y, Z, -1);
    new INI:File = INI_Open(PickPath(pickups));
    INI_SetTag(File,"HY's Dynamic Pickups");
    INI_WriteInt(File,"Pick-up ID", Pickup);
    INI_WriteFloat(File,"Pick-up X", X);
    INI_WriteFloat(File,"Pick-up Y", Y);
    INI_WriteFloat(File,"Pick-up Z", Z);
    INI_Close(File);
    Pick[playerid][pX] = X;
    Pick[playerid][pY] = Y;
    Pick[playerid][pZ] = Z;
    Pick[playerid][pID] = Pickup;
    return 1;
}

stock PickPath(pickups)
{
    new string[128];
    format(string,sizeof(string),PATH,pickups);
    return string;
}

forward LoadPickup_data(playerid,name[],value[]);
public LoadPickup_data(playerid,name[],value[])
{
    INI_Int("pID",Pick[playerid][pID]);
    INI_Float("pX",Pick[playerid][pX]);
    INI_Float("pY",Pick[playerid][pY]);
    INI_Float("pY",Pick[playerid][pZ]);
    return 1;
}
All code, now it's workin' fine, but isn't loaded In-Game. What problem have above script?
Reply
#9

tryed?

pawn Код:
public OnPlayerConnect(playerid)
{
   INI_ParseFile(PickPath(pickups), "LoadPickup_data", .bExtra = true, .extra = playerid);
   return 1;
}
Reply
#10

pawn Код:
public OnPlayerConnect(playerid)
{
   INI_ParseFile(PickPath(pickups), "LoadPickup_%s", .bExtra = true, .extra = playerid);
   return 1;
}
Yes I tried, look in the code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)