25.02.2011, 03:40
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.
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();
}