MySQL pickups question
#1

Hi. I'm scripting a little server for myself, I have not scripted anything for a long time tho.
My Pickups save to MySQL and load from there fine, but I need a script, that if you step on the pickups (PickupTypes are 1), you'll be teleported to somewhere else.
My MySQL struct:
Код:
INSERT INTO `pickups` (`PickupX`, `PickupY`, `PickupZ`, `PickupModel`, `PickupType`)
Code to spawn pickups
PAWN
Код:
stock AddPickupFromFile()
{
    new
		Str[67],
		PType,
		PModel,
		Float:PX,
		Float:PY,
		Float:PZ,
		pTotal;

	mysql_query("SELECT * FROM `pickups`");
	mysql_store_result();
    if(mysql_num_rows() > 0)
    {
        while(mysql_fetch_row(Str))
        {
	        sscanf(Str, "p<|>fffii", PX, PY, PZ, PModel, PType);
	        CreateDynamicPickup(PModel, PType, PX, PY, PZ, -1, -1, -1, PICKUPDISTANCE);
	        pTotal++;
		}
	}
	mysql_free_result();
	printf("** %i\t<->\tPickups Loaded From\t<->\tMySQL\t\t   **", pTotal);
	return 1;
}

stock AddPickupToFile(Float:PX, Float:PY, Float:PZ, PModel, PType)
{
	new
		Query[200];

	format(Query, sizeof(Query), "INSERT INTO `pickups` (PickupX, PickupY, PickupZ, PickupModel, PickupType) VALUES(%f, %f, %f, %d, %d)",
	PX, PY, PZ, PModel, PType);

	mysql_query(Query);
	mysql_free_result();
	return 1;
}
It's from [L3th4l]'s gm

Hope you understood my sh*tty English and can help me

Thanks
Reply


Messages In This Thread
MySQL pickups question - by Oliverraisk - 20.03.2011, 09:35
Re: MySQL pickups question - by Oliverraisk - 21.03.2011, 09:37
Re: MySQL pickups question - by MadeMan - 21.03.2011, 09:58
Re: MySQL pickups question - by Oliverraisk - 21.03.2011, 11:25

Forum Jump:


Users browsing this thread: 1 Guest(s)