SA-MP Forums Archive
Question about multiple saved locations. - 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: Question about multiple saved locations. (/showthread.php?tid=231199)



Question about multiple saved locations. - Desertsoulz - 25.02.2011

I want to use MySQL to save alot of things on my server. I just read a tutorial on how to setup MySQL and apply it to your gamemode and I was making random Hospital spawns and I was wondering how this works. I'm not going to copy/paste from my gamemode onto here but I'll break the code into parts.

I'm new to PAWN and MySQL so please correct me appropriately, thanks.
pawn Код:
enum HospitalLocation
{
 EntryID,
 HospitalWorld,
 HospitalExterior,
 HospitalX,
 HospitalY,
 HospitalZ,
};
new Hospital[MAX_PLAYERS][HospitalLocation];

OnPlayerDeath(playerid, killerid, reason);
{
 new row[128];
 new field[6][10];

 format(Hospital[playerid][EntryID], 10, "%s", field[1]);
 Hospital[playerid][HospitalWorld] = strval(field[2]);
 Hospital[playerid][HospitalExterior] = strval(field[3]);
 Hospital[playerid][HospitalX] = strval(field[4]);
 Hospital[playerid][HospitalY] = strval(field[5]);
 Hospital[playerid][HospitalZ] = strval(field[6]);

 if (Hospital[playerid][EntryID] >= 0);
 {
  SetPlayerWorld(playerid, Hospital[playerid][HospitalWorld]);
  SetPlayerInterior(playerid, Hospital[playerid][HospitalExterior]);
  SetPlayerPos(playerid, Hospital[playerid][HospitalX], Hospital[playerid][HospitalY], Hospital[playerid][HospitalZ]);
 }
 return 1();
}