[FilterScript] [FS] Saving player position and loading it on the next login
#7

Good work ! But i have another problem.

I don't want my player respawn at the LS hospital, but at its spawn. With 1 player class there is no problem, but when i tried to add the 2nd player class it shown me some errors.

Код:
C:\Users\isasteppe\Desktop\ServeurGTA\filterscripts\saveposition.pwn(76) : error 029: invalid expression, assumed zero
C:\Users\isasteppe\Desktop\ServeurGTA\filterscripts\saveposition.pwn(83) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Here is the modificated script :
Код:
#include <a_samp>
#include <Dini>
#include <dudb>

new Float:positionx;
new Float:positiony;
new Float:positionz;


main()
{
	print("\n----------------------------------");
	print("Test");
	print("----------------------------------\n");
}

public OnGameModeInit()
{
	SetGameModeText("Test");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(12,1958.3783, 1343.1572, 35.0000, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	printf("classid: %d", classid);
	switch (classid) {
		case 0:
			{
			GameTextForPlayer(playerid, "classe 0", 1000, 3);
			}
		case 1:
			{
			GameTextForPlayer(playerid, "classe 1", 1000, 3);
			}
	  }
  return 1;
}

public OnPlayerConnect(playerid)
{
	LoadStats(playerid);
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	new Float:x;
	new Float:y;
	new Float:z;

	GetPlayerPos(playerid,x,y,z);
	positionx = x;
	positiony = y;
	positionz = z;
	if (!dini_Exists(FileStats(playerid)))
	{
		dini_Create(FileStats(playerid));
	}

	SaveStats(playerid);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	SetPlayerPos(playerid,positionx,positiony,positionz);
	return 1;
}


//----- а modifier pour faire varier en fonction des spawns
public OnPlayerDeath(playerid, killerid, reason)
{
	if (case == 0) {
	SetPlayerPos(playerid,1958.3783, 1343.1572, 15.3746);
	positionx = 1958.3783;
	positiony = 1343.1572;
	positionz = 15.3746;
	}
	
	else if (case == 1) {
	SetPlayerPos(playerid,1958.3783, 1343.1572, 35.0000);
	positionx = 1958.3783;
	positiony = 1343.1572;
	positionz = 35.0000;
	}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/kill", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid,0);
		return 1;
	}
	return 0;
}

Player(playerid)
{
 new player[MAX_PLAYER_NAME];
 GetPlayerName(playerid, player, sizeof(player));
 return player;
}

FileStats(playerid)
{
  new a[256]; format(a, sizeof(a), "%s.ini",udb_encode(Player(playerid)));
  return a;
}

SaveStats(playerid)
{
  dini_IntSet(FileStats(playerid), "PositionX", floatround(positionx));
  dini_IntSet(FileStats(playerid), "PositionY", floatround(positiony));
  dini_IntSet(FileStats(playerid), "PositionZ", floatround(positionz));
}

LoadStats(playerid)
{
  positionx = dini_Int(FileStats(playerid), "PositionX");
  positiony = dini_Int(FileStats(playerid), "PositionY");
  positionz = dini_Int(FileStats(playerid), "PositionZ");
}
Btw i'm a newbie in scripting (started some days ago), i can have typed wrong things.
Reply


Messages In This Thread
[FS] Saving player position and loading it on the next login - by salehyassin - 08.08.2009, 21:43
Re: [FS] Saving player position and loading it on the next login - by Doppeyy - 08.08.2009, 22:01
Re: [FS] Saving player position and loading it on the next login - by LuxurioN™ - 09.08.2009, 00:53
Re: [FS] Saving player position and loading it on the next login - by ruarai - 09.08.2009, 03:18
Re: [FS] Saving player position and loading it on the next login - by nuriel8833 - 09.08.2009, 08:06
Re: [FS] Saving player position and loading it on the next login - by ruarai - 09.08.2009, 09:55
Re: [FS] Saving player position and loading it on the next login - by Alice[WS] - 09.08.2009, 15:46
Re: [FS] Saving player position and loading it on the next login - by salehyassin - 10.08.2009, 02:48
Re: [FS] Saving player position and loading it on the next login - by salehyassin - 10.08.2009, 02:49
Re: [FS] Saving player position and loading it on the next login - by salehyassin - 10.08.2009, 02:53
Re: [FS] Saving player position and loading it on the next login - by [P7]Vagrant - 10.08.2009, 03:21
Re: [FS] Saving player position and loading it on the next login - by ruarai - 10.08.2009, 06:02
Re: [FS] Saving player position and loading it on the next login - by Mauka4 - 10.08.2009, 17:01
Re: [FS] Saving player position and loading it on the next login - by salehyassin - 10.08.2009, 22:58
Re: [FS] Saving player position and loading it on the next login - by shady91 - 10.08.2009, 23:07
Re: [FS] Saving player position and loading it on the next login - by Cracker - 11.08.2009, 00:40
Re: [FS] Saving player position and loading it on the next login - by ruarai - 11.08.2009, 06:34
Re: [FS] Saving player position and loading it on the next login - by dafel2 - 11.08.2009, 07:07
Re: [FS] Saving player position and loading it on the next login - by Mauka4 - 11.08.2009, 12:49
Re: [FS] Saving player position and loading it on the next login - by salehyassin - 11.08.2009, 15:53
Re: [FS] Saving player position and loading it on the next login - by salehyassin - 11.08.2009, 16:02
Re: [FS] Saving player position and loading it on the next login - by Machinehank34 - 11.08.2009, 16:13
Re: [FS] Saving player position and loading it on the next login - by XCultz - 21.08.2009, 03:20
Re: [FS] Saving player position and loading it on the next login - by shady91 - 21.08.2009, 05:07
Re: [FS] Saving player position and loading it on the next login - by Karaula - 21.08.2009, 07:49
Re: [FS] Saving player position and loading it on the next login - by [LF]Mr.Lucci - 25.08.2009, 20:28
Re: [FS] Saving player position and loading it on the next login - by Imran.Abbas - 26.08.2009, 11:00
Re: [FS] Saving player position and loading it on the next login - by MatrixBoY - 26.08.2009, 14:46
Re: [FS] Saving player position and loading it on the next login - by Karaula - 27.08.2009, 09:11
Re: [FS] Saving player position and loading it on the next login - by Mike Garber - 23.08.2010, 16:40
Re: [FS] Saving player position and loading it on the next login - by Phanto90 - 04.06.2011, 05:59
Re: [FS] Saving player position and loading it on the next login - by PhoenixB - 13.08.2011, 21:16
Re: [FS] Saving player position and loading it on the next login - by [HP]Napola - 15.08.2012, 17:11
Re: [FS] Saving player position and loading it on the next login - by Mark Shade - 15.08.2012, 17:24
Re: [FS] Saving player position and loading it on the next login - by OuDayas - 10.01.2019, 16:57
Re: [FS] Saving player position and loading it on the next login - by xSkin - 10.01.2019, 22:30

Forum Jump:


Users browsing this thread: 1 Guest(s)