Pos for all
#1

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.
Reply
#2

If I understood right:
PHP код:
new Float:savedPosition[3]; // We'll store the position here

CMD:makepos(playeridargs) {
    
GetPlayerPosplayeridsavedPosition[0], savedPosition[1], savedPosition[2] );
    
SendClientMessageplayerid, -1"Position was saved" );
}

CMD:gotopos(playeridargs) {
    
SetPlayerPosplayeridsavedPosition[0], savedPosition[1], savedPosition[2] );
    
SendClientMessageplayerid, -1"You were teleported" );

Reply
#3

PHP код:
CMD:makepos(playeridparams[])
{
    if(
IsPlayerAdmin(playerid))
    {
        new 
Float:pos[3];
        
GetPlayerPos(playeridpos[0],pos[1],pos[2]);
        
pInfo[playerid][posX] = pos[0];
          
pInfo[playerid][posY] = pos[1];
          
pInfo[playerid][posZ] = pos[2];
    }
    else
    {
        
SendClientMessage(playerid1" (( You have to be a rcon admin to do this )) ");
    }
    return 
1;
}
CMD:gotopos(playeridparams[])
{
    if(
IsPlayerAdmin(playerid))
    {
        for(new 
0MAX_PLAYERSi++)
        {
            
SetPlayerPos(i,pInfo[playerid][posX],pInfo[playerid][posY],pInfo[playerid][posZ]);
        }
    }
    else
    {
        
SendClientMessage(playerid1" (( 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]; 
Reply
#4

Thanks all +rep.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)