[Help]Teleport command
#5

Quote:
Originally Posted by DrSega69
Посмотреть сообщение
what do i put for aDMTeles? im new to this soz
Put the enum and aDMTeles outside of a callback. Like this:

pawn Код:
// .. Enumeration for data for DM teleports.
enum DATA_DM_TPS
{
    Float:X,
    Float:Y,
    Float:Z,
}

// .. Constant array of coordinates for teleports for /dm.
stock const Float:aDMTeles[ ][ DATA_DM_TPS ] =
{
    { 2536.0, -1603.0, 18.0 },
    { 2641.0, -1621.0, 20.0 },
    { 2611.0, -1612.0, 26.0 },
    { 2516.0, -1610.0, 22.0 },
    { 2511.0, -1620.0, 28.0 },
    { 2556.0, -1606.0, 19.0 }
};

public OnPlayerCommandText(playerid, cmdtext[])
{
    if( !strcmp(cmdtext, "/dm") )
    {
        //If they typed /dm, create a new random variable ranging from 0 to the
        //size of the array of coordinates.
        new nRand = random(sizeof aDMTeles);

        //Set the player's position to one of the random entries within the array.
        SetPlayerPos( playerid, aDMTeles[nRand][X], aDMTeles[nRand][Y], aDMTeles[nRand][Z] );

        //Return true.
        return 1;
    }
}
Reply


Messages In This Thread
[Help]Teleport command - by DrSega69 - 27.12.2011, 15:58
Re: [Help]Teleport command - by Mauzen - 27.12.2011, 16:21
Re: [Help]Teleport command - by blewert - 27.12.2011, 16:23
Re: [Help]Teleport command - by DrSega69 - 27.12.2011, 16:52
Re: [Help]Teleport command - by blewert - 27.12.2011, 17:10
Re: [Help]Teleport command - by DrSega69 - 28.12.2011, 08:04

Forum Jump:


Users browsing this thread: 2 Guest(s)