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;
}
}