MySQL pickups question - 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: MySQL pickups question (
/showthread.php?tid=242563)
MySQL pickups question -
Oliverraisk - 20.03.2011
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
Re: MySQL pickups question -
Oliverraisk - 21.03.2011
Anyone :S?
Re: MySQL pickups question -
MadeMan - 21.03.2011
Use this callback
pawn Код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
if(pickupid == /*id you want to teleport from*/)
{
SetPlayerPos(playerid, /*coords*/);
}
return 1;
}
Re: MySQL pickups question -
Oliverraisk - 21.03.2011
Quote:
Originally Posted by MadeMan
Use this callback
pawn Код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid) { if(pickupid == /*id you want to teleport from*/) { SetPlayerPos(playerid, /*coords*/); } return 1; }
|
Thanks for reply.
But I only have x,y,z,pickup type and pickup model. Where could i get pickupid? No entry for this on mysql nor word "pickupid" in my pawno script.