Teleport command help! [REp+1]
#3

You would first need to make global variables, you can't define them in one function!

I wrote this very quick. It is a MERE example. Don't copy/paste as it might not work.

pawn Код:
new
    Float:eventX, //These are the variables that will hold the even info.
    Float:eventY,
    Float:eventZ
    eventInterior,
    eventVirtualWorld;
new
    Event = 0; //This is basically a bool.

CMD:startevent(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) //This command is for RCON Admins only.
    {
        SendClientMessage(playerid,0xFFFFFFFF,"You are not an admin.");
        return 1;
    }
    if(Event = 1) //If an event has been started, this will show.
    {
        SendClientMessage(playerid,0xFFFFFFFF,"An event has already been started.");
        return 1;
    }
    else
    {
        new //Defines variables for the Admin's name and string that will be sent to everyone."
            AdminName[MAX_PLAYER_NAME],
            eventstring[128];
        GetPlayerName(playerid,AdminName,sizeof(MAX_PLAYER_NAME)); //This formats the string.
        format(string,sizeof(string),"Administrator %s has started an event! Use /joinevent to enter!",AdminName);
        SendClientMessageToAll(0xFFFFFFFF,string); //Send everyone the string.
        Event = 1; //Says that an event has been started.
        GetPlayerPos(playerid,eventX,eventY,eventZ); //These things below sets the event information to the Admin's position.
        GetPlayerInterior(playerid,eventInterior);
        GetPlayerVirtualWorld(playerid,eventVirtualWorld);
        return 1;
    }
}
CMD:joinevent(playerid,params[])
{
    if(Event == 0) //If no event is not started, then do this.
    {
        SendClientMessage(playerid,0xFFFFFFFF,"An event has not been started.");
        return 1;
    }
    else
    {
        SetPlayerPos(playerid,eventX,eventY,eventZ); //This sets the player's position ot the event start.
        SetPlayerVirtualWorld(playerid,eventVirtualWorld);
        SetPlayerInterior(playerid,eventInterior);
        return 1;
    }
}
Reply


Messages In This Thread
Teleport command help! [REp+1] - by ProdrifterX - 18.02.2012, 09:17
Re: Teleport command help! [REp+1] - by Twisted_Insane - 18.02.2012, 09:25
Re: Teleport command help! [REp+1] - by ReneG - 18.02.2012, 16:37

Forum Jump:


Users browsing this thread: 3 Guest(s)