Originally Posted by Adamrcook
I'm working on a roleplay script right now, and I'm going from scratch. I have made some file saving for simple stuff such as Admin, Password, Kills, Score, etc. Now the problem is that no matter what, when you login you spawn at 0.0, 0.0, 0.0. Maybe a forth of the time you'll spawn where you actually logged out at. It also has a impact on the hospital script. When you die, it sets your camera to outside All Saints and starts a 30 second timer. After the timer it, charges you $100 and is suppose to spawn you outside the doors. Instead you spawn at 0.0, 0.0, 0.0. It's really annoying and I need some help. Just ask me what you need to see and I'll post it. Any and all help is appreciated.
|
public SetPlayerSpawn(playerid) { SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][pVirWorld]); SetPlayerInterior(playerid,PlayerInfo[playerid][pInt]); SetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z] + 1); return 1 }
{ fwrite(account, file); } if ((PlayerInfo[playerid][pPos_x]==0.0 && PlayerInfo[playerid][pPos_y]==0.0 && PlayerInfo[playerid][pPos_z]==0.0)) { PlayerInfo[playerid][pPos_x] = 1449.2389; PlayerInfo[playerid][pPos_y] = -2286.5237; PlayerInfo[playerid][pPos_z] = 13.5469; } format(file, sizeof file, "Pos_x=%.1f\n", PlayerInfo[playerid][pPos_x]); { fwrite(account, file); } format(file, sizeof file, "Pos_y=%.1f\n", PlayerInfo[playerid][pPos_y]); { fwrite(account, file); } format(file, sizeof file, "Pos_z=%.1f\n", PlayerInfo[playerid][pPos_z]); { fwrite(account, file); }
new Float:x, Float:y, Float:z; GetPlayerPos(playerid,x,y,z); PlayerInfo[playerid][pPos_x] = x; PlayerInfo[playerid][pPos_y] = y; PlayerInfo[playerid][pPos_z] = z; format(file, sizeof file, "Pos_x=%.1f\n", PlayerInfo[playerid][pPos_x]); { fwrite(account, file); } format(file, sizeof file, "Pos_y=%.1f\n", PlayerInfo[playerid][pPos_y]); { fwrite(account, file); } format(file, sizeof file, "Pos_z=%.1f\n", PlayerInfo[playerid][pPos_z]); { fwrite(account, file); }
if (strfind(passres, "Pos_z") != -1) { value = GetFileValue(pass); PlayerInfo[playerid][pPos_z] = strval(value); } if (strfind(passres, "Pos_x") != -1) { value = GetFileValue(pass); PlayerInfo[playerid][pPos_x] = strval(value); } if (strfind(passres, "Pos_y") != -1) { value = GetFileValue(pass); PlayerInfo[playerid][pPos_y] = strval(value);
public OnPlayerDeath(playerid, killerid, reason) { SendClientMessage(playerid, RED, "You are in Intensive Care, please calm down and wait"); SetPlayerPos(playerid,1173.5985,-1323.3386,15.1953); SetPlayerFacingAngle( playerid, 269.4324 ); TogglePlayerControllable(playerid, false); SetPlayerCameraPos(playerid, 1198.6255, -1348.5658, 17.7985); SetPlayerCameraLookAt(playerid, 1173.5985, -1323.3386, 15.1953); timer1 = SetTimer("hospital", 15000 , true); // 15 Seconds return 1; } public hospital(playerid) { GivePlayerMoney(playerid, -100); SendClientMessage(playerid, RED, "You are healthy again, your bill comes to $100, be safe out there"); TogglePlayerControllable(playerid, true); SetPlayerHealth(playerid, 100.0); SetPlayerPos(playerid,1173.5985,-1323.3386,15.1953); SetPlayerFacingAngle( playerid, 269.4324 ); SpawnPlayer(playerid); KillTimer(timer1); return 1; }
Originally Posted by XCultz
hope you get help
|
GetPlayerPos(playerid,PlayerInfo[playerid][pPos_x],PlayerInfo[playerid][pPos_y],PlayerInfo[playerid][pPos_z]);