Pos for all - 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: Pos for all (
/showthread.php?tid=596373)
Pos for all -
suni - 16.12.2015
Hey can someone show me a example of how to create a command like /makepos to save a position and /gotopos for all players to teleport to that place?
I removed the codes i created earlier so i can't post them here.(: i once make a saving position command work well but when the player use a command to teleport to that position i saved they teleport somewhere else.
Re: Pos for all -
prineside - 16.12.2015
If I understood right:
PHP код:
new Float:savedPosition[3]; // We'll store the position here
CMD:makepos(playerid, args) {
GetPlayerPos( playerid, savedPosition[0], savedPosition[1], savedPosition[2] );
SendClientMessage( playerid, -1, "Position was saved" );
}
CMD:gotopos(playerid, args) {
SetPlayerPos( playerid, savedPosition[0], savedPosition[1], savedPosition[2] );
SendClientMessage( playerid, -1, "You were teleported" );
}
Re: Pos for all -
malackov - 16.12.2015
PHP код:
CMD:makepos(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new Float:pos[3];
GetPlayerPos(playerid, pos[0],pos[1],pos[2]);
pInfo[playerid][posX] = pos[0];
pInfo[playerid][posY] = pos[1];
pInfo[playerid][posZ] = pos[2];
}
else
{
SendClientMessage(playerid, 1, " (( You have to be a rcon admin to do this )) ");
}
return 1;
}
CMD:gotopos(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
SetPlayerPos(i,pInfo[playerid][posX],pInfo[playerid][posY],pInfo[playerid][posZ]);
}
}
else
{
SendClientMessage(playerid, 1, " (( You have to be a rcon admin to do this )) ");
}
return 1;
}
you could try this ( didn't test this ), but add on the top of the page
PHP код:
enum PlayerData {
Float:posX,
Float:posY,
Float:posZ
}
new pInfo[MAX_PLAYERS][PlayerData];
Re: Pos for all -
suni - 16.12.2015
Thanks all +rep.