LOL habe es jetzt alleine hingekriegt Also für alle die ein Stunt Server haben und ein gutes save- und loadpositions script brauchen hier bitte sehr
Edit: Habe nen bug behoben jetzt gehts einwandfrei!
#include <a_samp>
#define COLOR_BLAU 0x0066FFAA
//Savep //Loadp
new Float:PosX[MAX_PLAYERS], Float:PosY[MAX_PLAYERS], Float:PosZ[MAX_PLAYERS], Float:PosA[MAX_PLAYERS], PosI[MAX_PLAYERS];
new FahrzeugID[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/spos", true)==0)
{
if(IsPlayerInAnyVehicle(playerid))
{
FahrzeugID[playerid] = GetPlayerVehicleID(playerid);
GetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
GetVehicleZAngle(GetPlayerVehicleID(playerid), PosA[playerid]);
PosI[playerid] = (GetPlayerInterior(playerid));
SendClientMessage(playerid, COLOR_BLAU, "Positon gespeichert! Gehe zu dieser Possiton mit /lpos!");
}
else
{
FahrzeugID[playerid] = GetPlayerVehicleID(playerid);
GetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
GetPlayerFacingAngle(playerid, PosA[playerid]);
PosI[playerid] = (GetPlayerInterior(playerid));
SendClientMessage(playerid, COLOR_BLAU, "Positon gespeichert! Gehe zu dieser Possiton mit /lpos!");
}
return 1;
}
if (strcmp(cmdtext, "/lpos", true)==0)
{
if (!floatsqroot(PosX[playerid]+PosY[playerid]+PosZ[playerid]))
{
return SendClientMessage(playerid, COLOR_BLAU, "Benutze zuerst /spos!");
}
else
{
if(IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid), PosX[playerid], PosY[playerid], PosZ[playerid]);
SetVehicleZAngle(GetPlayerVehicleID(playerid), PosA[playerid]);
SetPlayerInterior(playerid, PosI[playerid]);
LinkVehicleToInterior(GetPlayerVehicleID(playerid), PosI[playerid]);
SetCameraBehindPlayer(playerid);
SendClientMessage(playerid, COLOR_BLAU, "Gespeicherte Position geladen!");
}
else
{
if (!(FahrzeugID[playerid]))
{
SetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
SetPlayerFacingAngle(playerid, PosA[playerid]);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, PosI[playerid]);
SendClientMessage(playerid, COLOR_BLAU, "Gespeicherte Position geladen!");
}
else
{
SetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
SetPlayerFacingAngle(playerid, PosA[playerid]);
SetVehiclePos(FahrzeugID[playerid], PosX[playerid], PosY[playerid], PosZ[playerid]);
SetVehicleZAngle(FahrzeugID[playerid], PosA[playerid]);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, PosI[playerid]);
LinkVehicleToInterior(FahrzeugID[playerid], PosI[playerid]);
PutPlayerInVehicle(playerid, FahrzeugID[playerid], 0);
SendClientMessage(playerid, COLOR_BLAU, "Gespeicherte Position geladen!");
}
}
}
return 1;
}