What is wrong with this script? menu

User Tag List

Results 1 to 3 of 3
  1. #1
    XxCyanidexX's Avatar Member
    Reputation
    56
    Join Date
    Nov 2008
    Posts
    138
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What is wrong with this script?

    Hi,
    I have gotten many bugs out of this script, but I am still getting 2 errors. Whoever tells me what the problem is gets +Rep.

    Script:
    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

    What is wrong with this script?
  2. #2
    Vindicated's Avatar Contributor
    Reputation
    226
    Join Date
    Aug 2008
    Posts
    1,067
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This block of code:
    else
    {
    pPlayer->BroadcastMessage("You cannot leave an event that is currently not underway!");
    }
    has an else that doesn't match an if (there's not a if that goes with that else). And on the second error your argument is wrong. Either there is supposed to be more arguments or no arguments.


  3. #3
    XxCyanidexX's Avatar Member
    Reputation
    56
    Join Date
    Nov 2008
    Posts
    138
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks so much, all I needed to do was change the statement to if(Message == plrLeave && EventStarted == false) and it worked. +Rep but I need to spread first.

Similar Threads

  1. [Lua Script] What is wrong with this script!?
    By Cuodin in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 04-05-2011, 10:00 AM
  2. What is wrong with this item teleportation Lua script ?
    By Wheeze201 in forum WoW EMU Questions & Requests
    Replies: 6
    Last Post: 08-13-2009, 08:50 AM
  3. What is Wrong with my Script
    By Juicyz in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 05-23-2008, 07:37 PM
  4. [helpzerz] What is wrong with this lua script?
    By w21froster in forum World of Warcraft Emulator Servers
    Replies: 8
    Last Post: 05-21-2008, 09:45 PM
  5. [Need help] What's wrong with this script?
    By Arthas117 in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 01-10-2008, 02:04 PM
All times are GMT -5. The time now is 11:39 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search