SA-MP Forums Archive
GameTextForPlayer @ timer and Saving a PlayerInfo variable. - 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: GameTextForPlayer @ timer and Saving a PlayerInfo variable. (/showthread.php?tid=112055)



GameTextForPlayer @ timer and Saving a PlayerInfo variable. - KnooL - 05.12.2009

Hi,

I'm in need of explanation on saving PlayerInfo variables like (Jailed = 1 or Jailed = 0, FirstSpawn =1, FirstSpawn = 0 and saving that into a file)

And then read it back again when the player spawns again.

Also I'm in need of explanation on how to get gametext on a timer.

Thank you,
KnooL


Codes:
pawn Code:
Command_(jail)
{
if (help)
{
Text_Send(playerid, "JAIL_HELP");
Text_SendFormat(playerid, "JAIL_HELP1", "jail");
}
if (PlayerInfo[player][Jailed] == 1)
{
Text_Send(playerid, "ALREADY_JAILED");
}
else
{
if(sscanf(params, "uzi", player, kbreason, timen))
{
Text_Send(playerid, "JAIL_HELP");
Text_SendFormat(playerid, "JAIL_HELP1", "jail");
}
else if (IsPlayerConnected(player))
{
timern = SetTimer("JailTime", timen, 0);
GetPlayerName(player, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
Text_SendFormat(player, "YOU_GOT_JAILED", ReturnPlayerName(playerid), playerid, kbreason);
PlayerInfo[player][Jailed] = 1;
OnPlayerJailed(player);
}
}
if (!IsPlayerConnected(player))
{
Text_Send(playerid, "NOT_CONNECTED");
}
return 1;
}
pawn Code:
public JailTime()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
  if (PlayerInfo[i][Jailed] == 1)
  {
    SetPlayerInterior(i, 6);
    SetPlayerPos(i, 266.9272,78.6098,1001.0391);
    SetPlayerFacingAngle(i, 266.9169);
    TogglePlayerControllable(i, 1);
}
}
}
Works without errors or warnings. Haven't tested it out yet in-game, the only thing I need is how to get gametext on how much jail time is left.

Thanks in advance.