i need help with my /s (save pos) and /l (load pos) -
[EDT]AmanSingh123 - 01.05.2011
okay bassicly when im in a vehicle and do /s to save my pos and then do /l to load that pos i just saved i dont teleport their with my vehicle i just tele their on foot without my vehicle, and i dont know how to fix it :S heres my FS script..
#include <a_samp>
#define SUCCESS 0xFFFF00AA
#define UNSUCCESS 0xAA3333AA
#define SCM SendClientMessage
new Pozicija[MAX_PLAYERS];
public OnFilterScriptInit()
{
print("|| Pozicija Sistem by Matt Loaded ||");
return true;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp("/s", cmdtext, true))
{
new Float

poz,Float:ypoz,Float:zpoz;
GetPlayerPos(playerid,xpoz,ypoz,zpoz);
GetVehiclePos(playerid,xpoz,ypoz,zpoz);
SetPVarFloat(playerid,"XPos",xpoz); SetPVarFloat(playerid,"YPos",ypoz); SetPVarFloat(playerid,"ZPos",zpoz);
SCM(playerid, SUCCESS, "You have saved your position, now type /l to go back their");
if(Pozicija[playerid] == 0)
{
Pozicija[playerid] = 1;
}
return true;
}
if(!strcmp("/l", cmdtext, true))
{
if(Pozicija[playerid] == 1)
{
SetPlayerPos(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos"));
SetVehiclePos(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos"));
SCM(playerid, SUCCESS, "You have teleported to your last saved position.");
}
else SCM(playerid, UNSUCCESS, "You didn't save your position! Please type /s again.");
return true;
}
return false;
}
Re: i need help with my /s (save pos) and /l (load pos) -
[EDT]AmanSingh123 - 01.05.2011
can anybody please help me??
Re: i need help with my /s (save pos) and /l (load pos) -
[EDT]AmanSingh123 - 01.05.2011
anyone?
Re: i need help with my /s (save pos) and /l (load pos) -
itachi4x4 - 01.05.2011
Quote:
Originally Posted by [EDT]AmanSingh123
okay bassicly when im in a vehicle and do /s to save my pos and then do /l to load that pos i just saved i dont teleport their with my vehicle i just tele their on foot without my vehicle, and i dont know how to fix it :S heres my FS script..
#include <a_samp>
#define SUCCESS 0xFFFF00AA
#define UNSUCCESS 0xAA3333AA
#define SCM SendClientMessage
new Pozicija[MAX_PLAYERS];
public OnFilterScriptInit()
{
print("|| Pozicija Sistem by Matt Loaded ||");
return true;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp("/s", cmdtext, true))
{
new Float  poz,Float:ypoz,Float:zpoz;
GetPlayerPos(playerid,xpoz,ypoz,zpoz);
GetVehiclePos(playerid,xpoz,ypoz,zpoz);
SetPVarFloat(playerid,"XPos",xpoz); SetPVarFloat(playerid,"YPos",ypoz); SetPVarFloat(playerid,"ZPos",zpoz);
SCM(playerid, SUCCESS, "You have saved your position, now type /l to go back their");
if(Pozicija[playerid] == 0)
{
Pozicija[playerid] = 1;
}
return true;
}
if(!strcmp("/l", cmdtext, true))
{
if(Pozicija[playerid] == 1)
{
SetPlayerPos(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos"));
SetVehiclePos(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos"));
SCM(playerid, SUCCESS, "You have teleported to your last saved position.");
}
else SCM(playerid, UNSUCCESS, "You didn't save your position! Please type /s again.");
return true;
}
return false;
}
|
Use this
pawn Код:
if (GetPlayerState == 1)//is player on foot
{
if(Pozicija[playerid] == 1)
{
SetPlayerPos(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos"));
}
if (GetPlayerState == 2)//is player Driver inside a car
{
SetVehiclePos(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos"));
SCM(playerid, SUCCESS, "You have teleported to your last saved position.");
}
else SCM(playerid, UNSUCCESS, "You didn't save your position! Please type /s again.");
return true;
}
}
return false;
Dont forget to indent it a little to fit your code
Re: i need help with my /s (save pos) and /l (load pos) -
[EDT]AmanSingh123 - 01.05.2011
Quote:
Originally Posted by itachi4x4
Use this
pawn Код:
if (GetPlayerState == 1)//is player on foot { if(Pozicija[playerid] == 1) { SetPlayerPos(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos")); } if (GetPlayerState == 2)//is player Driver inside a car { SetVehiclePos(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos")); SCM(playerid, SUCCESS, "You have teleported to your last saved position."); } else SCM(playerid, UNSUCCESS, "You didn't save your position! Please type /s again."); return true; } } return false;
Dont forget to indent it a little to fit your code
|
Could just please edit my script? because im new to scripting
Re: i need help with my /s (save pos) and /l (load pos) -
[EDT]AmanSingh123 - 01.05.2011
help
Re: i need help with my /s (save pos) and /l (load pos) -
Ubuntu - 01.05.2011
Use this bro:
Код:
if (GetPlayerState == 1)//is player on foot { if(Pozicija[playerid] == 1) { SetPlayerPos(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos")); } if (GetPlayerState == 2)//is player Driver inside a car { SetVehiclePos(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos")); SCM(playerid, SUCCESS, "You have teleported to your last saved position."); } else SCM(playerid, UNSUCCESS, "You didn't save your position! Please type /s again."); return true; } } return false;
Put that script in OnPlayerKeyStateChange....