09.08.2009, 15:46
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.
Here is the modificated script :
Btw i'm a newbie in scripting (started some days ago), i can have typed wrong things.
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.
Код:
#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"); }