27.03.2013, 15:28
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:
When a player registers, the spawn info is been set:
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:
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!
The enum:
pawn Код:
enum sInfo
{
Float:sPosX,
Float:sPosY,
Float:sPosZ,
Float:sFacingAngle,
sMoney,
sSkin
}
new SpawnInfo[sInfo];
pawn Код:
SetSpawnInfo(playerid, 0, SpawnInfo[sSkin], SpawnInfo[sPosX], SpawnInfo[sPosY], SpawnInfo[sPosZ], SpawnInfo[sFacingAngle], 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
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);
}
Anybody knows what's the problems?
Thanks in advance!