Position Saver Help! [ASAP]
#1

Hello,
Ive made a simple /save and /load position script. After i save a position. Then i load it i go there without the car i was sitting in. So i was wondering who can tweak this so when i load a position i saved i go there with the car i was in.

Код:
if(strcmp(cmdtext, "/s", true) ==0)
{
		if(IsPlayerConnected(playerid))
{
     		new Float:x,Float:y,Float:z;
    		GetPlayerPos(playerid,x,y,z);
    		SetPVarFloat(playerid,"xpos",x); // save X POS
    		SetPVarFloat(playerid,"ypos",y); // save Y POS
    		SetPVarFloat(playerid,"zpos",z); // save Z POS
    		SetPVarInt(playerid,"int",GetPlayerInterior(playerid));//get interior
    		SendClientMessage(playerid,0x33AA33AA,"Position Saved! Use /l To Get back To It!,");
}
		return 1;
}
    if (strcmp("/l", cmdtext, true, 10) == 0)
{
		SetPlayerPos(playerid, GetPVarFloat(playerid,"xpos"), GetPVarFloat(playerid,"ypos"), GetPVarFloat(playerid,"zpos"));
		SetPlayerInterior(playerid, GetPVarInt(playerid,"int"));
		SendClientMessage(playerid, 0x33AA33AA, "Loaded Saved Position.");
   		return 1;
}
Reply
#2

just use this
pawn Код:
if(strcmp("/s", cmdtext, true, 10) == 0)
    {
    GetPlayerPos(playerid, Pos[playerid][0], Pos[playerid][1], Pos[playerid][2]);
    SendClientMessage(playerid, 0x00FF44, "[SERVER]: Your position has been saved. Use /l to load it.");
    return 1;
    }
    if(strcmp("/l", cmdtext, true, 10) == 0)
    {
    SetPlayerPos(playerid, Pos[playerid][0], Pos[playerid][1], Pos[playerid][2]);
    SendClientMessage(playerid, 0x00FF44, "[SERVER]: Your position has been loaded.");
    return 1;
    }
Reply
#3

Quote:
Originally Posted by [A]ndrei
Посмотреть сообщение
just use this
pawn Код:
if(strcmp("/s", cmdtext, true, 10) == 0)
    {
    GetPlayerPos(playerid, Pos[playerid][0], Pos[playerid][1], Pos[playerid][2]);
    SendClientMessage(playerid, 0x00FF44, "[SERVER]: Your position has been saved. Use /l to load it.");
    return 1;
    }
    if(strcmp("/l", cmdtext, true, 10) == 0)
    {
    SetPlayerPos(playerid, Pos[playerid][0], Pos[playerid][1], Pos[playerid][2]);
    SendClientMessage(playerid, 0x00FF44, "[SERVER]: Your position has been loaded.");
    return 1;
    }
as far as i see it will only save for the current position in-game.. not for always the player joins..
Reply
#4

Quote:
Originally Posted by Jarnu
Посмотреть сообщение
as far as i see it will only save for the current position in-game.. not for always the player joins..
whats he has explained is exactly what i have given him...
Reply
#5

Quote:
Originally Posted by [A]ndrei
Посмотреть сообщение
whats he has explained is exactly what i have given him...
Guess you didn't pay close attention..

Anyways here you go:
pawn Код:
if(strcmp(cmdtext, "/s", true) ==0)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        SetPVarFloat(playerid,"xpos",x); // save X POS
        SetPVarFloat(playerid,"ypos",y); // save Y POS
        SetPVarFloat(playerid,"zpos",z); // save Z POS
        SetPVarInt(playerid,"int",GetPlayerInterior(playerid));//get interior
        SendClientMessage(playerid,0x33AA33AA,"Position Saved! Use /l To Get back To It!,");
    }
    return 1;
}
if (strcmp("/l", cmdtext, true, 10) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if (GetPlayerState(playerid) == 2)
        {
            new tmpcar = GetPlayerVehicleID(playerid);
            SetVehiclePos(tmpcar, GetPVarFloat(playerid,"xpos"),GetPVarFloat(playerid,"ypos"),GetPVarFloat(playerid,"zpos"));
            LinkVehicleToInterior(tmpcar, GetPVarInt(playerid,"int"));
        }
        else
        {
            SetPlayerPos(playerid, GetPVarFloat(playerid,"xpos"), GetPVarFloat(playerid,"ypos"), GetPVarFloat(playerid,"zpos"));
            SetPlayerInterior(playerid, GetPVarInt(playerid,"int"));
        }
        SendClientMessage(playerid, 0x33AA33AA, "Loaded Saved Position.");
    }
    return 1;
}
Reply
#6

When i injected the /s script then compiled to test. I got 4 errors .. Sorry guys im new.


Код:
C:\DOCUME~1\account\Desktop\rrg\GAMEMO~1\Kudoz.pwn(1995) : error 017: undefined symbol "Pos"
C:\DOCUME~1\account\Desktop\rrg\GAMEMO~1\Kudoz.pwn(1995) : warning 215: expression has no effect
C:\DOCUME~1\account\Desktop\rrg\GAMEMO~1\Kudoz.pwn(1995) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\account\Desktop\rrg\GAMEMO~1\Kudoz.pwn(1995) : error 029: invalid expression, assumed zero
C:\DOCUME~1\account\Desktop\rrg\GAMEMO~1\Kudoz.pwn(1995) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#7

Just use the one i posted, i just tweaked it like you asked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)