SA-MP Forums Archive
Need some help with loading Checkpoints from mySQL house - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need some help with loading Checkpoints from mySQL house (/showthread.php?tid=225015)



Need some help with loading Checkpoints from mySQL house - jesse237 - 12.02.2011

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;
}



Re: Need some help with loading Checkpoints from mySQL house - DVDK - 12.02.2011

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.


Re: Need some help with loading Checkpoints from mySQL house - jesse237 - 12.02.2011

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.