19.02.2012, 11:20
hello i just made my /loadplace command and /saveplace.
/saveplace works. but the /loadplace makes me strange.
even i do /saveplace it still not working and it says
"You don't have /saveplace, /saveplace first!"
maybe the problem is here
but still i'm not sure if the problem is because of that one. just to be sure i put my /saveplace and /loadplace code below
/saveplace works. but the /loadplace makes me strange.
even i do /saveplace it still not working and it says
"You don't have /saveplace, /saveplace first!"
maybe the problem is here
pawn Код:
/* OnDialogResponse - dialogid - DIALOG_REGISTER */
dini_FloatSet(file, "X", PlayerInfo[playerid][PlX] = 0);
dini_FloatSet(file, "Y", PlayerInfo[playerid][PlY] = 0);
dini_FloatSet(file, "Z", PlayerInfo[playerid][PlZ] = 0);
dini_IntSet(file, "Interior", PlayerInfo[playerid][InteriorP] = 0);
dini_IntSet(file, "World", PlayerInfo[playerid][World] = 0);
pawn Код:
CMD:saveplace(playerid, params[])
{
new pname[MAX_PLAYER_NAME],file[256];
new Float:PX, Float:PY, Float:PZ;
GetPlayerPos(playerid, PX, PY, PZ);
GetPlayerName(playerid, pname, sizeof(pname));
if(PlayerInfo[playerid][Admin] > 1)
{
format(file, sizeof(file), "ServerFiles/Users/%s.ini", pname);
PlayerInfo[playerid][PlX] = PX;
PlayerInfo[playerid][PlY] = PY;
PlayerInfo[playerid][PlZ] = PZ;
PlayerInfo[playerid][InteriorP] = GetPlayerInterior(playerid);
PlayerInfo[playerid][World] = GetPlayerVirtualWorld(playerid);
dini_FloatSet(file, "X", PlayerInfo[playerid][PlX]);
dini_FloatSet(file, "Y", PlayerInfo[playerid][PlY]);
dini_FloatSet(file, "Z", PlayerInfo[playerid][PlZ]);
dini_IntSet(file, "Interior", PlayerInfo[playerid][InteriorP]);
dini_IntSet(file, "World", PlayerInfo[playerid][World]);
SendClientMessage(playerid, COLOR_GREEN, "| - You save your place location! - |");
SendClientMessage(playerid, -1, "(/loadplace) to go back to your saved place location");
}
else return SendClientMessage(playerid, COLOR_RED, "You must be Administrator Level 1 or higher to use this command!");
return 1;
}
CMD:loadplace(playerid, params[])
{
new pname[MAX_PLAYER_NAME],file[256];
new Float:PX, Float:PY, Float:PZ;
GetPlayerPos(playerid, PX, PY, PZ);
GetPlayerName(playerid, pname, sizeof(pname));
if(PlayerInfo[playerid][Admin] > 1)
{
if(dini_Int(file, "X") == 0 || dini_Int(file, "Y") == 0 || dini_Int(file, "Z") == 0)
{
SendClientMessage(playerid, COLOR_RED, "You do not have /saveplace!, /saveplace first!");
}
else
{
format(file, sizeof(file), "ServerFiles/Users/%s.ini", pname);
PlayerInfo[playerid][PlX] = dini_Float(file, "X");
PlayerInfo[playerid][PlY] = dini_Float(file, "Y");
PlayerInfo[playerid][PlZ] = dini_Float(file, "Z");
PlayerInfo[playerid][InteriorP] = dini_Int(file, "Interior");
PlayerInfo[playerid][World] = dini_Int(file, "World");
SetPlayerPos(playerid, PlayerInfo[playerid][PlX], PlayerInfo[playerid][PlY], PlayerInfo[playerid][PlZ]);
SetPlayerInterior(playerid, PlayerInfo[playerid][InteriorP]);
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][World]);
SendClientMessage(playerid, COLOR_GREEN, "| - You load your place location! - |");
}
}
else return SendClientMessage(playerid, COLOR_RED, "You must be Administrator Level 1 or higher to use this command!");
return 1;
}