HelpMe #7 [+REP] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: HelpMe #7 [+REP] (
/showthread.php?tid=298808)
HelpMe #7 [+REP] -
NessaHD - 22.11.2011
WASSSSSUUUPPPPPPPP :P
Lawl im kidding. :P
I want a answer on this:
How could i save a player's pos in a command, then in a other command he could get to there again. I know its possible but dunno how to code it..
More advanced, when a player types in /afk it will save he's coords and get him to a special position.
Then, when he type in /back, it will get the player's coords and put him back to that place where he was at last.
Re: HelpMe #7 [+REP] -
IceCube! - 22.11.2011
*Sign* ******?
*Sigh* Script request thread?
https://sampforum.blast.hk/showthread.php?tid=256537
Check the bottem of this page!
Credit to Lorenc
Re: HelpMe #7 [+REP] -
fiki574 - 22.11.2011
Код:
if (strcmp(cmdtext, "/spos", true)==0)
{
GetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
GetPlayerFacingAngle(playerid, PosA[playerid]);
GameTextForPlayer(playerid,"~g~Position Saved! Use ~w~/lpos!",4000,3);
PosI[playerid] = (GetPlayerInterior(playerid));
PlayerPlaySound(playerid, 1137 , 0.0, 0.0, 0.0);
new string[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s commanded Save Position (/spos)", pname);
SendClientMessageToAll(COLOR_BLUE, string);
return 1;
}
if (strcmp(cmdtext, "/lpos", true)==0)
{
if (!floatsqroot(PosX[playerid]+PosY[playerid]+PosZ[playerid]))
{
return GameTextForPlayer(playerid,"~r~USE ~w~/spos ~r~FIRST!",4000,3);
}
else
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetVehiclePos(GetPlayerVehicleID(playerid), PosX[playerid], PosY[playerid], PosZ[playerid]);
SetVehicleZAngle(GetPlayerVehicleID(playerid), PosA[playerid]);
SetCameraBehindPlayer(playerid);
LinkVehicleToInterior(GetPlayerVehicleID(playerid), PosI[playerid]);
}
else
{
InCar[playerid] = false;
SetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
SetPlayerFacingAngle(playerid, PosA[playerid]);
SetCameraBehindPlayer(playerid);
}
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
SetPlayerInterior(playerid, PosI[playerid]);
GameTextForPlayer(playerid,"~g~Position loaded!",4000,3);
}
new string[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s commanded Load Position (/lpos)", pname);
SendClientMessageToAll(COLOR_BLUE, string);
return 1;
}
Evo!
Re: HelpMe #7 [+REP] -
NessaHD - 22.11.2011
eh hvala fiki, AJD NA SERVER!!!
Re: HelpMe #7 [+REP] -
SmiT - 22.11.2011
Well, you can store the player poistion in some arrays, e.g:
pawn Код:
new
Float: pX[ MAX_PLAYERS ],
Float: pY[ MAX_PLAYERS ],
Float: pZ[ MAX_PLAYERS ]
;
CMD:afk( playerid, params[] )
{
GetPlayerPos ( playerid, pX[ playerid ], pY[ playerid ], pZ[ playerid ] );
/* store his positions in the variables */
return ( 1 );
}
CMD:back( playerid, params[] )
{
SetPlayerPos( playerid, pX[ playerid ], pY[ playerid ], pZ[ playerid ] );
/* set his positions to the coordinates saved in the variables */
return ( 1 );
}