new GMX[MAX_PLAYERS]
stock UpdateStats(playerid)
{
new Float:PosX, Float:PosY, Float:PosZ; //Making the floats.
GetPlayerPos(playerid, PosX, PosY, PosZ); //This gets your current position, and saves them into variables.
new INI:File = INI_Open(UserPath(playerid)); //Opens the file.
INI_SetTag(File,"data");
INI_WriteFloat(File,"X",PosX); //This uses saves the X coordinate.
INI_WriteFloat(File,"Y",PosY); //This uses saves the Y coordinate.
INI_WriteFloat(File,"Z",PosZ); //This uses saves the Z coordinate.
INI_WriteInt(File,"VW",GetPlayerVirtualWorld(playerid)); //This is needed for if you disconnect in a interior, so you don't fall from the sky.
INI_WriteInt(File,"Interior",GetPlayerInterior(playerid)); // Same as above.
INI_Close(File); //Closes the file.
}
cmd(gmx, playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 4) return SCM(playerid, GREY, "You are not authorized to use this command"); //Your admin information here.
SendClientMessageToAll(LIGHTRED, "GMX has been initiated by an admin, it will happen in 30 seconds."); //Sends a message to everyone telling them that a GMX will happen.
SetTimer("GMXi", 30000, false); //Setting a timer to call this function.
SetTimer("GMXl", 28000, false); //Setting a timer to call this function.
return 1;
}
forward GMXl(); //You need to forward the function.
public GMXl()
{
for (new i = 0; i != MAX_PLAYERS; ++i)// This creates a loop(Can be replaced with foreach)
{
GMX[i] = 1;
UpdateStats(i);/
}
}
forward GMXi();
public GMXi()
{
SendRconCommand("GMX");
}
public OnPlayerDisconnect
{
if(GMX[playerid] == 1)
{
GMX[playerid] = 0;
}
else
{
//Saving code here.
}
return 1;
}
: error 017: undefined symbol "UserPath"
new INI:File = INI_Open(UserPath(playerid)); //Opens the file.
CMD:gmx(playerid,params[])
{
for(new i = 0;i<MAX_PLAYERS;i++)
{
UpdateStats(i);
}
SendRconCommand("gmx");
}
Or you could just do this.
pawn Код:
|
Код:
: error 017: undefined symbol "UserPath" pawn Код:
|
#define PATH "/Users/%s.ini"
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}