PDA

View Full Version : Save position


Matevos
02/10/2009, 10:13 AM
Hi, I'm new user in this forum. I'm from Polish so my english is bad :)


My question is: "How to make in my server command "Save position" and "Load position" player.
This is must be script.

Please make for me this command because I do not know language "pawn"
I know only C++ and Visual Basic.

DSK_Vyorel
02/10/2009, 01:23 PM
enum SavePosENUM { Float:sX, Float:sY, Float:sZ, Float:sA, SavedPos };
new SavePos[MAX_PLAYERS][SavePosENUM];



if(!strcmp(cmdtext, "/spos",true) || !strcmp(cmdtext,"/sp",true))
{
if (IsPlayerInAnyVehicle(playerid))
{
GetVehiclePos(GetPlayerVehicleID(playerid), SavePos[playerid][sX], SavePos[playerid][sY], SavePos[playerid][sZ]);
GetVehicleZAngle(GetPlayerVehicleID(playerid), SavePos[playerid][sA]);
}
else
{
GetPlayerPos(playerid, SavePos[playerid][sX], SavePos[playerid][sY], SavePos[playerid][sZ]);
GetPlayerFacingAngle(playerid, SavePos[playerid][sA]);
}
SavePos[playerid][SavedPos] = 1;
return SendClientMessage(playerid, COLOR_WHITE,"Pozitie salvata, foloseste /lp pentru a reveni inapoi.");
}
//------------------------------------------------------------------------------
if(!strcmp(cmdtext, "/lp",true) || !strcmp(cmdtext,"/lpos",true))
{
SetCameraBehindPlayer(playerid);
if (SavePos[playerid][SavedPos] == 0) return SendClientMessage(playerid, COLOR_WHITE, "[SERVERBOT]> Foloseste /sp");
if (IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid), SavePos[playerid][sX], SavePos[playerid][sY], SavePos[playerid][sZ]);
SetVehicleZAngle(GetPlayerVehicleID(playerid), SavePos[playerid][sA]);
}
else
{
SetPlayerPos(playerid, SavePos[playerid][sX], SavePos[playerid][sY], SavePos[playerid][sZ]);
SetPlayerFacingAngle(playerid, SavePos[playerid][sA]);
}
return SendClientMessage(playerid, COLOR_WHITE, "Ai revenit la ultima pozitie salvata");
}

Matevos
02/10/2009, 02:49 PM
Where I must paste this first code and where I must paste this second code??

Correlli
02/10/2009, 04:34 PM
My question is: "How to make in my server command "Save position" and "Load position" player.
This is must be script.


Try to look for DINI/DUDB topic and tutorial how to save player's position with DINI/DUDB, it's on this forum, just try to search a little.

Matevos
02/10/2009, 07:05 PM
I can't find this.

Please say my where I must this paste.

Or send me link with this.

Correlli
02/10/2009, 07:06 PM
http://forum.sa-mp.com/index.php?topic=4798.0
http://forum.sa-mp.com/index.php?topic=4798.msg59458#msg59458
If that's what you're looking for.

Pawno_Master
02/10/2009, 07:15 PM
uhh you can automatticly save something already?

just use /save [your text here] and it will just save in server or debug you dont need a cmd for that

Matevos
02/10/2009, 07:31 PM
When I compile code I have this Error:

C:\Użytkownicy\Mateusz\Pulpit\Multiplayer Server\gamemodes\freeroam.pwn(15) : fatal error 100: cannot read from file: "dini"

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

Correlli
02/10/2009, 07:32 PM
You need to put dini.inc into "\pawno\include\" folder.

Matevos
02/10/2009, 07:36 PM
Where I can find this file?

Pawno_Master
02/10/2009, 07:38 PM
Matevos you don't need any code just use /save [your text]

just try it man

Correlli
02/10/2009, 07:39 PM
In the links i gave you before, but here's the direct link:
http://dracoblue.net/download/dini-16/35/
http://dracoblue.net/download/dudb-24/31/



Matevos you don't need any code just use /save [your text]

just try it man

And how do you know he's asking for a command to save coordinates? He still didn't said what exactly he wants, but i think he wants to be able to save and load player's position when they re-connect.

Matevos
02/10/2009, 07:47 PM
Now I have this error and I need this file:

C:\Users\Mateusz\Desktop\Multiplayer Server\pawno\include\dudb.inc(25) : fatal error 100: cannot read from file: "dutils"

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

Correlli
02/10/2009, 07:48 PM
Get DUtils: http://dracoblue.net/download/dutils-110/30/

And you still didn't answered our question: are you looking for player-account-position-saving or just command to save the coordinates?

Matevos
02/10/2009, 07:51 PM
Sorry because I do not understand you.

Please look at this error:

C:\Users\Mateusz\Desktop\Multiplayer Server\gamemodes\freeroam.pwn(1228) : error 017: undefined symbol "MOJ"
C:\Users\Mateusz\Desktop\Multiplayer Server\gamemodes\freeroam.pwn(1247) : error 017: undefined symbol "MOJ"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.

Pawno_Master
02/10/2009, 07:54 PM
use new MOJ

and tell us what you exactly need and let us see something about your script man

Correlli
02/10/2009, 07:57 PM
C:\Users\Mateusz\Desktop\Multiplayer Server\gamemodes\freeroam.pwn(1228) : error 017: undefined symbol "MOJ"



What do you want to do with MOJ? Show the code so we can tell you how to define it CORRECTLY.

Madsen
12/04/2011, 05:35 PM
enum SavePosENUM { Float:sX, Float:sY, Float:sZ, Float:sA, SavedPos };
new SavePos[MAX_PLAYERS][SavePosENUM];



if(!strcmp(cmdtext, "/spos",true) || !strcmp(cmdtext,"/sp",true))
{
if (IsPlayerInAnyVehicle(playerid))
{
GetVehiclePos(GetPlayerVehicleID(playerid), SavePos[playerid][sX], SavePos[playerid][sY], SavePos[playerid][sZ]);
GetVehicleZAngle(GetPlayerVehicleID(playerid), SavePos[playerid][sA]);
}
else
{
GetPlayerPos(playerid, SavePos[playerid][sX], SavePos[playerid][sY], SavePos[playerid][sZ]);
GetPlayerFacingAngle(playerid, SavePos[playerid][sA]);
}
SavePos[playerid][SavedPos] = 1;
return SendClientMessage(playerid, COLOR_WHITE,"Pozitie salvata, foloseste /lp pentru a reveni inapoi.");
}
//------------------------------------------------------------------------------
if(!strcmp(cmdtext, "/lp",true) || !strcmp(cmdtext,"/lpos",true))
{
SetCameraBehindPlayer(playerid);
if (SavePos[playerid][SavedPos] == 0) return SendClientMessage(playerid, COLOR_WHITE, "[SERVERBOT]> Foloseste /sp");
if (IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid), SavePos[playerid][sX], SavePos[playerid][sY], SavePos[playerid][sZ]);
SetVehicleZAngle(GetPlayerVehicleID(playerid), SavePos[playerid][sA]);
}
else
{
SetPlayerPos(playerid, SavePos[playerid][sX], SavePos[playerid][sY], SavePos[playerid][sZ]);
SetPlayerFacingAngle(playerid, SavePos[playerid][sA]);
}
return SendClientMessage(playerid, COLOR_WHITE, "Ai revenit la ultima pozitie salvata");
}

omg ty :D!!!

Freeway69
12/05/2012, 09:45 AM
Hey can you upload the script with amx ?
I have too many errors -.-
PLS UPLOAD!