Code:
#include "StdAfx.h"
#include "Setup.h"
#include <string>
#include <iostream>
using namespace std;
static string infoHelp, gmEventStart, gmEventEnd, gmRemind, gmSetPos, gmSpecOn, gmSpecOff, plrJoin, plrLeave, plrSpectate, plrStuck;
float x,y,z,sx,sy,sz;
uint32 mapid,smapid;
bool EventStarted, CanSpectate;
void EventOnChat(Player * pPlayer, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
{
//GM Commands
gmEventStart = ".event start";
gmEventEnd = ".end";
gmRemind = ".event remind";
gmSetPos = ".event setpos";
gmSpecOn = ".event setspec on";
gmSpecOff = ".event setspec off";
gmEventStart = "!event start";
gmEventEnd = "!event end";
gmRemind = "!event remind";
gmSetPos = "!event setpos";
gmSpecOn = "!event setspec on";
gmSpecOff = "!event setspec off";
//Player Commands
plrJoin = "!join";
plrLeave = "!leave";
plrSpectate = "!spectate";
plrStuck = "!stuck";
if(pPlayer->GetSession()->HasGMPermissions() )
{
if(Message == gmEventStart)
{
char Msg[255];
sprintf(Msg, "%s has started an event! Type !join to join!", pPlayer->GetName());
sWorld.SendWorldText(Msg);
EventStarted = true;
x = pPlayer->GetPositionX();
y = pPlayer->GetPositionY();
z = pPlayer->GetPositionZ();
mapid = pPlayer->GetMapId();
}
if(Message == gmEventEnd)
{
char Msg[255];
sprintf(Msg, "%s has ended the event!", pPlayer->GetName());
sWorld.SendWorldText(Msg);
EventStarted = false;
x = 0.0;
y = 0.0;
z = 0.0;
mapid = 0;
}
if(Message == gmRemind)
{
sWorld.SendWorldText("There is an event going on! Type !join to join.");
}
if(Message == gmSetPos)
{
if(EventStarted)
{
char msg[255];
sprintf(msg, "The summon position has changed. Type !join to Join!");
sWorld.SendWorldText(msg);
x = pPlayer->GetPositionX();
y = pPlayer->GetPositionY();
z = pPlayer->GetPositionZ();
mapid = pPlayer->GetMapId();
}
else
{
pPlayer->BroadcastMessage("You cannot remap event coordinates when there is no event going on!");
}
}
if(Message == gmSpecOn)
{
CanSpectate = true;
sWorld.SendWorldText("If you would like to spectate, type !spec.");
sx = pPlayer->GetPositionX();
sy = pPlayer->GetPositionY();
sz = pPlayer->GetPositionZ();
smapid = pPlayer->GetMapId();
}
if(Message == gmSpecOff)
{
CanSpectate = false;
sWorld.SendWorldText("Spectating has been disabled.");
sx = 0.0;
sy = 0.0;
sz = 0.0;
smapid = 0;
}
}
else
{
if(Message == plrJoin && EventStarted)
{
pPlayer->BroadcastMessage("Joining the current event...");
pPlayer->EventTeleport(mapid, x, y, z);
}
else
{
pPlayer->BroadcastMessage("Tere are no events at this time, you must wait for a GM to start one!");
}
if(Message == plrLeave && EventStarted)
{
if(pPlayer->GetTeam() == 1)
{
pPlayer->BroadcastMessage("You have left the event. You will be teleported to Shattrath.");
pPlayer->EventTeleport(530, -1835.797852, 5423.517578, -12.427971);
}
else
{
pPlayer->BroadcastMessage("You have left the event. You will be teleported to Shattrath.");
pPlayer->EventTeleport(530, -1835.797852, 5423.517578, -12.427971);
}
else
{
pPlayer->BroadcastMessage("You cannot leave an event that is currently not underway!");
}
if(Message == plrSpectate && EventStarted)
{
if(CanSpectate)
{
pPlayer->EventTeleport(smapid, sx, sy, sz);
pPlayer->SetMovement(MOVE_ROOT,1);
}
else
{ // IF spectating is disabled then ...
pPlayer->BroadcastMessage("Spectating is disabled.");
}
}
}
if(Message == plrStuck)
{
pPlayer->ResurrectPlayer(NULL);
pPlayer->EventTeleport(530, -1835.797852, 5423.517578, -12.427971);
pPlayer->BroadcastMessage("You have been sent to Shattrath.");
}
}
}
void SetupEventCmd(ScriptMgr * mgr)
{
EventStarted = false;
CanSpectate = false;
mgr->register_hook(SERVER_HOOK_EVENT_ON_CHAT, (bool *) EventOnChat);
}
Build Output:
Code:
1>------ Build started: Project: ExtraScripts, Configuration: Release Win32 ------
1>Compiling...
1>cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
1>EventMgr.cc
1>..\src\ExtraScripts\EventMgr.cc(120) : warning C4305: 'argument' : truncation from 'double' to 'float'
1>..\src\ExtraScripts\EventMgr.cc(120) : warning C4305: 'argument' : truncation from 'double' to 'float'
1>..\src\ExtraScripts\EventMgr.cc(120) : warning C4305: 'argument' : truncation from 'double' to 'float'
1>..\src\ExtraScripts\EventMgr.cc(125) : warning C4305: 'argument' : truncation from 'double' to 'float'
1>..\src\ExtraScripts\EventMgr.cc(125) : warning C4305: 'argument' : truncation from 'double' to 'float'
1>..\src\ExtraScripts\EventMgr.cc(125) : warning C4305: 'argument' : truncation from 'double' to 'float'
1>..\src\ExtraScripts\EventMgr.cc(128) : error C2181: illegal else without matching if
1>..\src\ExtraScripts\EventMgr.cc(147) : error C2660: 'Player::ResurrectPlayer' : function does not take 1 arguments
1>..\src\ExtraScripts\EventMgr.cc(148) : warning C4305: 'argument' : truncation from 'double' to 'float'
1>..\src\ExtraScripts\EventMgr.cc(148) : warning C4305: 'argument' : truncation from 'double' to 'float'
1>..\src\ExtraScripts\EventMgr.cc(148) : warning C4305: 'argument' : truncation from 'double' to 'float'
1>Build log was saved at "file://c:\ArcEmu Compiles\trunk\src\scripts\projects\2008_int_release_extrascripts\BuildLog.htm"
1>ExtraScripts - 2 error(s), 10 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Please help me and thanks for your time