Spawning problem
#1

So, I've tried to make a dynamic spawn system so that an admin can set the spawn pos & money, skin id IG, so he doesn't need to change it in the script. But it doesn't work. Whenever I set the spawn position, money and skin ID, and I make a new account and log in, I just spawn at blueberry while i'm falling. I don't have the money I set and also not the skin ID.

The enum:

pawn Код:
enum sInfo
{
    Float:sPosX,
    Float:sPosY,
    Float:sPosZ,
    Float:sFacingAngle,
    sMoney,
    sSkin
}
new SpawnInfo[sInfo];
When a player registers, the spawn info is been set:

pawn Код:
SetSpawnInfo(playerid, 0, SpawnInfo[sSkin], SpawnInfo[sPosX], SpawnInfo[sPosY], SpawnInfo[sPosZ], SpawnInfo[sFacingAngle], 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
The spawn info is being get from a .cfg file, but it appears it doesn't read from it, or it's just bugged.
My function to load it:

pawn Код:
forward LoadSpawnData();
public LoadSpawnData()
{
    if(!fexist("LERP/spawndata.cfg")) { return 1; }
   
    new SpawnString[200];
    new File: SpawnFile = fopen("LERP/spawndata.cfg", io_read);
   
    sscanf(SpawnString, "p<|>ffffdd",
        SpawnInfo[sPosX],
        SpawnInfo[sPosY],
        SpawnInfo[sPosZ],
        SpawnInfo[sFacingAngle],
        SpawnInfo[sMoney],
        SpawnInfo[sSkin]
    );
   
    return fclose(SpawnFile);
}
The Save function works, the coordinates and all gets saved, but then when I make a new account & go in my server I just start falling in blueberry, and I don't get the spawn money I set and I don't have the set Skin ID.

Anybody knows what's the problems?
Thanks in advance!
Reply
#2

Try to use a Include to Save System, it's much more simple. Try use DOF2, bINI or Y_Ini.
Reply
#3

I know, but by switching methods everytime you encounter a problem you aren't going to learn a thing. I want to know why it doesn't work and how to fix it so I can actually learn something.
Reply
#4

Anybody knows?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)