/save /load script please, i need help -
Hippotipus - 16.01.2011
Ive been trying for hours to get a /save /load postion script working. It loads the players postion fine but if your in a car, it only teles the player and not the car. Please help!
Re: /save /load script please, i need help -
Kase - 16.01.2011
pawn Код:
new Float:pSavedPos[MAX_PLAYERS][4];
new bool:HasPlayerSavedPos[MAX_PLAYERS];
pawn Код:
if(strcmp(cmdtext, "/save", true, 5) == 0)
{
new Float:X, Float:Y, Float:Z, Float:Ang;
if(IsPlayerInAnyVehicle(playerid))
{
new VehID = GetPlayerVehicleID(playerid);
GetVehiclePos(VehID, X, Y, Z);
GetVehicleZAngle(VehID, Ang);
}
else
{
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Ang);
}
pSavedPos[playerid][0] = X;
pSavedPos[playerid][1] = Y;
pSavedPos[playerid][2] = Z;
pSavedPos[playerid][3] = Ang;
HasPlayerSavedPos[playerid] = true;
SendClientMessage(playerid, 0xdf0f00ff, "* Your position has been successfully saved!");
return 1;
}
pawn Код:
if(strcmp(cmdtext, "/load", true, 5) == 0)
{
if(!HasPlayerSavedPos[playerid])
return SendClientMessage(playerid, 0xdf0f00ff, "* You didn't save any position yet!");
if(IsPlayerInAnyVehicle(playerid))
{
new VehID = GetPlayerVehicleID(playerid);
SetVehiclePos(VehID, pSavedPos[playerid][0], pSavedPos[playerid][1], pSavedPos[playerid][2]);
SetVehicleZAngle(VehID, pSavedPos[playerid][3]);
PutPlayerInVehicle(playerid, VehID, 0);
SendClientMessage(playerid, 0xdf0f00ff, "* You and your vehicle have been successfully teleported to the saved position!");
}
else
{
SetPlayerPos(playerid, pSavedPos[playerid][0], pSavedPos[playerid][1], pSavedPos[playerid][2]);
SetPlayerFacingAngle(playerid, pSavedPos[playerid][3]);
SendClientMessage(playerid, 0xdf0f00ff, "* You've been successfully teleported to the saved position!");
}
return 1;
}
It should work, let me know
Re: /save /load script please, i need help -
WillyP - 16.01.2011
Quote:
Originally Posted by Kase
-code-
It should work, let me know 
|
You forgot the vehicle position saving.
Re: /save /load script please, i need help -
Hippotipus - 16.01.2011
I save the position and when i load it it says i never saved a positon
Re: /save /load script please, i need help -
Kase - 16.01.2011
Quote:
Originally Posted by [FU]Victious
You forgot the vehicle position saving.
|
Yeah, you're right. Now it should be good
Quote:
Originally Posted by Hippotipus
I save the position and when i load it it says i never saved a positon
|
Really strange, I couldn't find any error in my script
Try with the edited code I just posted, it may work.
Re: /save /load script please, i need help -
DVDK - 16.01.2011
Quote:
Originally Posted by Hippotipus
I save the position and when i load it it says i never saved a positon
|
You cannot use /save because it's already in use by SA:MP.
Re: /save /load script please, i need help -
Kase - 16.01.2011
Aww yeah, I didn't think about that! Hippotipus, I guess you can simply modify the commands' names, it will surely work
Re: /save /load script please, i need help -
Hippotipus - 16.01.2011
yea did that so i could test it, ill try ur edited one :P
Re: /save /load script please, i need help -
Hippotipus - 16.01.2011
still says position not saved o.O
Re: /save /load script please, i need help -
WillyP - 16.01.2011
Debug it?