pawn Код:
new EventState;
new Float:local[4];
new Evento[MAX_PLAYERS];
CMD:criarevento(playerid)
{
if(EventState > 0) return SendClientMessage(playerid,-1,"Um evento ja foi criado!");
if(IsPlayerAdmin(playerid))
{
GetPlayerPos(playerid,local[0],local[1],local[2]);
local[3] = GetPlayerInterior(playerid);
EventState = 1;
new adm[24], evento[80];
GetPlayerName(playerid,adm,24);
format(evento,sizeof evento,"[EVENTO] O Admin %s criou um evento. /irevento para ir",adm);
SendClientMessageToAll(-1,evento);
}
else SendClientMessage(playerid,-1,"Vocк nгo й um admin!");
return 1;
}
CMD:irevento(playerid)
{
switch(EventState)
{
case 0: return SendClientMessage(playerid,-1,"NEnhum evento foi criado!");
case 1:
{
SetPlayerInterior(playerid,local[3]);
SetPlayerPos(playerid,local[0],local[1],local[2]);
SendClientMessage(playerid,-1,"Vocк foi para o evento! Vocк pode sair com /sairevento");
Evento[playerid] = 1;
new a[24], b[60];
GetPlayerName(playerid,a,24);
format(b,60,"[EVENTO] %s entrou no evento!",a);
SendMessageToEvento(-1,a);
}
case 2: return SendClientMessage(playerid,-1,"Evento jб foi iniciado!");
}
return 1;
}
CMD:iniciarevento(playerid)
{
if(EventState != 1) return SendClientMessage(playerid,-1,"Evento nгo foi criado ou jб comeзou!");
if(IsPlayerAdmin(playerid))
{
EventState = 2;
SendClientMessageToAll(-1,"O Evento foi iniciado e trancado!");
}
return 1;
}
CMD:sairevento(playerid)
{
if(IsInEvent(playerid))
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,0,0,0); // arruma aki pra onde o jogador vai nascer... Ou use
// SpawnPlayer(playerid);
new a[24], b[60];
GetPlayerName(playerid,a,24);
format(b,60,"[EVENTO] %s saiu do evento!",a);
SendMessageToEvento(-1,a);
}
return 1;
}
stock IsInEvent(playerid)
{
if(Evento[playerid] >= 1) return 1;
else return 0;
}
stock SendMessageToEvento(color,msg[])
{
for(new a=0;a<MAX_PLAYERS;a++)
{
if(IsPlayerConnected(a))
{
if(Evento[a] > 0)
{
SendClientMessage(a,color,msg);
}
}
}
}