Need some help with loading Checkpoints from mySQL house
#1

yeah, I'm trying to create a mySQL house system for my server, it's going pretty well, but I got struck on this problem, I've been trying to solve it for 3 hours now, used all kinds of method and right now I really can't seem to fix it myself, so I hope someone is ready to help me.

Code:
forward LoadHouses2(iPlayer);
public LoadHouses2(iPlayer)
{
	new
		Query[700],
		dHouseID,
		dHouseOwner[24],
		Float:houseX,
		Float:houseY,
		Float:houseZ;

	if(mysql_fetch_row(Query))
	{
		sscanf(Query, "e<p<|>ds[24]fff>", dHouseID, dHouseOwner, houseX, houseY, houseZ); // Remember to update this if you add more info...
		mysql_free_result();
		HouseCount ++;
		new h = HouseCount;
		HouseCPOut[h] = CreateDynamicCP(houseX, houseY, houseZ, 1.5, 0, 0, -1, 5.0);

	}
	return 1;
}


// ---------------------------------------------------------------------------------------------------------

public OnGameModeInIt();
{
	SetTimer("LoadHouses2", 500, 0);
        return 1;
}
So the problem is, that the checkpoint doesn't show up when I restart the server.
Also I was wondering if this could be done without timer, because I'm having an exact same stock function, no differences between the stock function LoadHouses and public function LoadHouses2. Except that the LoadHouses can't be used for the SetTimer.

Maybe something like this?
Code:
forward LoadHouses3();
public LoadHouses3()
{
	new iPlayer;  // I know this is probably wrong... but my mind is sort of "fucked" right now.. can't think straight.
	LoadHouses(iPlayer);
	return 1;
}

stock LoadHouses(iPlayer)
{
	new
		Query[700];

	if(mysql_fetch_row(Query))
	{
		sscanf(Query, "e<p<|>ds[24]fff>", PVar2[iPlayer]); // Remember to update this if you add more info...
		mysql_free_result();
                // foreach(Player, i)
		HouseCount ++;
		new h = HouseCount;
		HouseCPOut[h] = CreateDynamicCP(PVar2[h][hX], PVar2[h][hY], PVar2[h][hZ], 1.5, 0, 0, -1, 5.0);

	}
	return 1;
}
Reply
#2

This is a really bad way of scripting, i don't even know what you're doing,
this doesn't look like a house system at all, go back and learn the basics of PAWN again, everything is just so wrong.
Reply
#3

Yeah.. thanks =.= this really got me down.. even more.
I'll guess I just need some sleep right now. But yes you are sort of right.. I got a little bit frustrated, when it didn't worked so I did things.. tried things which I can't even remember.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)