Így nem lenne egyszerûbb?
nem teszteltem, de fele annyi az egész és átláthatóbb
#include <a_samp>
#include <zcmd>
#include <sscanf2>
new Float:spX[4][MAX_PLAYERS],Float:spY[4][MAX_PLAYERS],Float:spZ[4][MAX_PLAYERS],Float:spA[4][MAX_PLAYERS];
new bool:SavedPos[4][MAX_PLAYERS];
#define LPT(%1) SendClientMessage(%1, -1, \"{ffff99}* Pozíciód {57a433}sikeresen {ffff99}betöltve.\")
#define SPT(%1) SendClientMessage(%1, -1, \"{ffff99}* Pozíciód mentve, használd a {57a433}/lp {ffff99}parancsot a vissza teleportáláshoz.\")
public OnPlayerConnect(playerid)
{
for(new i=0; i<4; i++)
{
SavedPos[playerid] = false;
}
return 1;
}
public OnPlayerDisconnect(playerid)
{
for(new i=0; i<4; i++)
{
SavedPos[playerid] = false;
}
return 1;
}
CMD:sp(playerid, params[])
{
new number;
if(sscanf(params, \"d\", number)) return SendClientMessage(playerid, -1, \"{ffff99}/sp [1-5]\");
if(number > 0 && number < 6)
SavePos(playerid, number);
else
SendClientMessage(playerid, -1, \"{ffff99}/sp[1-5]\");
return 1;
}
CMD:lp(playerid, params[])
{
new number;
if(sscanf(params, \"d\", number)) return SendClientMessage(playerid, -1, \"{ffff99}/lp [1-5]\");
if(number > 0 && number < 6)
LoadPos(playerid, number);
else
SendClientMessage(playerid, -1, \"{ffff99}/lp [1-5]\");
return 1;
}
stock SavePos(playerid, num)
{
GetPlayerPos(playerid,spX[num][playerid],spY[num][playerid],spZ[num][playerid]);
GetPlayerFacingAngle(playerid,spA[num][playerid]);
SavedPos[num][playerid] = true;
SPT(playerid);
}
stock LoadPos(playerid, num)
{
if(SavedPos[num][playerid] == true)
{
SetPlayerPos(playerid,spX[num][playerid],spY[num][playerid],spZ[num][playerid]);
SetPlayerFacingAngle(playerid,spA[num][playerid]);
LPT(playerid);
} else {
SendClientMessage(playerid, -1, \"{FF4646}Még nincs mentett pozíciód az {DDDDDD}/sp 1{ff4646} -nél/nál.\");
}
}