Teleport Command
#1

pawn Код:
command(teleport, playerid, params[])
{
    if(Player[playerid][AdminLevel] >= 1)
    {
    if(isnull(params))
    {
        SendClientMessage(playerid, WHITE, "USAGE: /teleport <location>");
        SendClientMessage(playerid, WHITE, "Sections: LS | SF");
    }

    if(!strcmp(params, "ls", true)) // Los Santos
    {
       if (GetPlayerState(playerid) == 2)
          {
              SetVehiclePos(GetPlayerVehicleID(playerid), 1529.6,-1691.2,13.3);
          }
          else
          {
              SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
          }
          SendClientMessage(playerid, RED, "You have been teleported.");
          SetPlayerInterior(playerid,0);
          /*PlayerInfo[playerid][pLocal] = 0;*/
          SetPlayerVirtualWorld(playerid, 0);
    }
    if(!strcmp(params, "sf", true)) // San Fierro
    {
       if (GetPlayerState(playerid) == 2)
          {
              SetVehiclePos(GetPlayerVehicleID(playerid), 1529.6,-1691.2,13.3);
          }
          else
          {
              SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
          }
          SendClientMessage(playerid, RED, "You have been teleported.");
          SetPlayerInterior(playerid,0);
          /*PlayerInfo[playerid][pLocal] = 0;*/
          SetPlayerVirtualWorld(playerid, 0);
    }
    return true;
    }
}
It gives me these errors..

Quote:

C:\Users\owner\Desktop\SCRP\Server Files\gamemodes\SCRP.pwn(17555) : warning 217: loose indentation
C:\Users\owner\Desktop\SCRP\Server Files\gamemodes\SCRP.pwn(17570) : warning 217: loose indentation
C:\Users\owner\Desktop\SCRP\Server Files\gamemodes\SCRP.pwn(17577) : warning 209: function "cmd_teleport" should return a value

I'm not worried about the indentation, I'm rubbish at that, but I'm not sure what warning 209 is about.. line 17577 is the final bracket at the bottom of the pawn code.
Reply
#2

Hope this helps, also took the liberty of indenting it for you.

pawn Код:
command(teleport, playerid, params[])
{
    if(Player[playerid][AdminLevel] >= 1)
    {
        if(isnull(params))
        {
            SendClientMessage(playerid, WHITE, "USAGE: /teleport <location>");
            SendClientMessage(playerid, WHITE, "Sections: LS | SF");
        }
        if(!strcmp(params, "ls", true)) // Los Santos
        {
            if (GetPlayerState(playerid) == 2)
            {
                SetVehiclePos(GetPlayerVehicleID(playerid), 1529.6,-1691.2,13.3);
            }
            else
            {
                SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
            }
            SendClientMessage(playerid, RED, "You have been teleported.");
            SetPlayerInterior(playerid,0);
            /*PlayerInfo[playerid][pLocal] = 0;*/
            SetPlayerVirtualWorld(playerid, 0);
        }
        if(!strcmp(params, "sf", true)) // San Fierro
        {
            if (GetPlayerState(playerid) == 2)
            {
                SetVehiclePos(GetPlayerVehicleID(playerid), 1529.6,-1691.2,13.3);
            }
            else
            {
                SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
            }
            SendClientMessage(playerid, RED, "You have been teleported.");
            SetPlayerInterior(playerid,0);
            /*PlayerInfo[playerid][pLocal] = 0;*/
            SetPlayerVirtualWorld(playerid, 0);
        }
        return true;
    }
    return 1;
}
Reply
#3

Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)