ShipEvent with Timer. FIXED

Status
Not open for further replies.
I'm overrated.
Decennium
Joined
Apr 10, 2008
Messages
4,093
Reaction score
1,270
Spiceal Thanks to : C-Servers.
Intructions :

1). Make a new CPP file and call it ShipEvent.cpp or just replace the scrpt with your own ShipEvent.cpp
2). Paste the script below in 5.
3). Save, Open npcsscripts.h
4). Haev fun.
5). The script for ShipEvent.cpp

#include "NPCs.h"
#include "NPCsScripts.h"
#include "Levels.h"
#include "Player.h"
#include "MySQLM.h"
#include "shipevent.h"
#include "maps.h"
#include <vector>


void NPCsScripts::npc_1032008(NPC* npc){
Player* player = npc->getPlayer();
int state = npc->getState();
int playersmax = MySQL::getInt("shipevent",1,"aplayers");
int playersride = MySQL::getInt("shipevent",1,"aonride");
int playerswait = MySQL::getInt("shipevent",1,"awaiting");
if(player->getLevel() >= 10 && player->getLevel() <= 200){
if(state == 0){
if(playersmax == 0){
npc->addText("There are currently already 20 people on the ship. Please wait.");
npc->end();
}
}
else if(playersmax == 1){
npc->addText("There is currently 1 player in the Ship. Would you like to enter the Ship?");
npc->sendYesNo();
}
else if(playersmax == 2){
npc->addText("There are currently 2 players in the Ship. Would you like to enter the Ship?");
npc->sendYesNo();
}
else if(playersmax == 3){
npc->addText("There are currently 3 players in the Ship. Would you like to enter the Ship?");
npc->sendYesNo();
}
else if(playersmax == 4){
npc->addText("There are currently 4 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 5){
npc->addText("There are currently 5 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 6){
npc->addText("There are currently 6 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 7){
npc->addText("There are currently 7 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 8){
npc->addText("There are currently 8 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 9){
npc->addText("There are currently 9 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 10){
npc->addText("There are currently 10 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 11){
npc->addText("There are currently 11 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 12){
npc->addText("There are currently 12 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 13){
npc->addText("There are currently 13 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 14){
npc->addText("There are currently 14 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 15){
npc->addText("There are currently 15 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 16){
npc->addText("There are currently 16 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 17){
npc->addText("There are currently 17 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 18){
npc->addText("There are currently 18 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 19){
npc->addText("There are currently 19 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 20){
npc->addText("There are currently 20 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == -1){
npc->addText("The Ship is currenlty disabled.");
npc->sendSimple();
npc->end();
}
}
else if(state == 1){
if(npc->getSelected() == YES){
MySQL::setInt("shipevent","playersmax",1,playersmax+1) ;
npc->teleport(101000301);
vector<Player*> players=Maps::info[101000301].Players;
for(unsigned int i=0;i<players.size();i++){
Maps::changeMap(players ,200090000, 0);
}
}
else if(npc->getSelected() == NO){
npc->addText("Oh, Then, I will see you later.");
npc->end();
}
else{
npc->addText("It seems that something is worng with the ship. Contact your admin.");
npc->sendSimple();
npc->end();
}
}
}




6. Open npcsscripts.h, And paste that :

case 1032008: npc_1032008(npc); break;
static void npc_1032008(NPC* npc);

7. Open your MySql / Navicat.
Download the Batch File below :



Excute that file,
Tick Continue Errors!!!
And have fun!!!
Working fine,
Any errors post here.

 
Last edited:
Re: [Release] ShipEvent - Timer - Maps.

Ya I wante dto add then
else (

NPC->addetxt ("You must be 1-10 level blabla");
npc->end();

I'll add later .
 
Re: [Release] ShipEvent - Timer - Maps.

Nice Testing now

i got some errors: :s
PHP:
------ Build started: Project: MapleStoryServer, Configuration: Release Win32 ------
Compiling...
ship.cpp
.\ship.cpp(16) : error C2653: 'MySQl' : is not a class or namespace name
.\ship.cpp(16) : error C3861: 'getInt': identifier not found
.\ship.cpp(24) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(28) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(32) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(36) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(41) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(46) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(51) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(56) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(61) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(66) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(71) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(76) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(81) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(86) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(91) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(96) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(101) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(106) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(111) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(116) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(121) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(129) : error C2065: 'aplayers' : undeclared identifier
.\ship.cpp(131) : error C2563: mismatch in formal parameter list
.\ship.cpp(131) : error C2563: mismatch in formal parameter list
.\ship.cpp(137) : error C2065: 'timer' : undeclared identifier
.\ship.cpp(137) : error C2227: left of '->setTimer' must point to class/struct/union/generic type
        type is ''unknown-type''
.\ship.cpp(137) : error C2671: 'NPCsScripts::npc_1032008' : static member functions do not have 'this' pointers
Build log was saved at "file://d:\Documents and Settings\~Calvin~\Bureaublad\Games\Cune-MS\MapleStoryServer\Release\BuildLog.htm"
MapleStoryServer - 29 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========
You didn't load excute ShipEvent.sql
and in the MySqI
Change to MySQL
 
Re: [Release] ShipEvent - Timer - Maps.

and in the MySqI
Change to MySQL

???
Yeah,
And excute the file.

FOR THOOSE DOESNT HAEV SHIP EVENT.H :

#include "Timer.h"
#include "stdio.h"

class TimerEvent: public Timer::TimerHandler {
void handle (Timer* timer, int id);
void remove(int id){}
};
[a new header file called shipevent.h]
 
Re: [Release] ShipEvent - Timer - Maps.

someone know about this errors..
1>.\src\ChannelServer\ShipEvent.cpp(145) : error C2563: mismatch in formal parameter list
1>.\src\ChannelServer\ShipEvent.cpp(145) : error C2563: mismatch in formal parameter list

in this line if( min==8 || min ==0){
 
Re: [Release] ShipEvent - Timer - Maps.

why is there
Code:
player->getLevel() <= 200

Can't you change it to 1?
So everyone can enter?

And what do you need to do with the .mysql file?
 
Re: [Pre-Release] ShipEvent with Timer. FIXED

.\ShipEvent.cpp(129) : error C2065: 'playersma' : undeclared identifier
.\ShipEvent.cpp(129) : error C2146: syntax error : missing ')' before identifier 'x'
.\ShipEvent.cpp(129) : error C2059: syntax error : ')'

Use this to fix that error:
King123321 make a typ fould.

PHP:
#include "NPCs.h"
#include "NPCsScripts.h"
#include "Levels.h"
#include "Player.h"
#include "MySQLM.h"
#include "shipevent.h"
#include "maps.h"
#include <vector>


void NPCsScripts::npc_1032008(NPC* npc){
Player* player = npc->getPlayer();
int state = npc->getState();
int playersmax = MySQL::getInt("shipevent",1,"aplayers");
int playersride = MySQL::getInt("shipevent",1,"aonride");
int playerswait = MySQL::getInt("shipevent",1,"awaiting");
if(player->getLevel() >= 10 && player->getLevel() <= 200){
if(state == 0){
if(playersmax == 0){
npc->addText("There are currently already 20 people on the ship. Please wait.");
npc->end();
}
}
else if(playersmax == 1){
npc->addText("There is currently 1 player in the Ship. Would you like to enter the Ship?");
npc->sendYesNo();
}
else if(playersmax == 2){
npc->addText("There are currently 2 players in the Ship. Would you like to enter the Ship?");
npc->sendYesNo();
}
else if(playersmax == 3){
npc->addText("There are currently 3 players in the Ship. Would you like to enter the Ship?");
npc->sendYesNo();
}
else if(playersmax == 4){
npc->addText("There are currently 4 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 5){
npc->addText("There are currently 5 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 6){
npc->addText("There are currently 6 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 7){
npc->addText("There are currently 7 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 8){
npc->addText("There are currently 8 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 9){
npc->addText("There are currently 9 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 10){
npc->addText("There are currently 10 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 11){
npc->addText("There are currently 11 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 12){
npc->addText("There are currently 12 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 13){
npc->addText("There are currently 13 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 14){
npc->addText("There are currently 14 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 15){
npc->addText("There are currently 15 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 16){
npc->addText("There are currently 16 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 17){
npc->addText("There are currently 17 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 18){
npc->addText("There are currently 18 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 19){
npc->addText("There are currently 19 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == 20){
npc->addText("There are currently 20 players in the Ship. Would you like to enter the Ship?");
npc->sendSimple();
npc->end();
}
else if(playersmax == -1){
npc->addText("The Ship is currenlty disabled.");
npc->sendSimple();
npc->end();
}
}
else if(state == 1){
if(npc->getSelected() == YES){
MySQL::setInt("shipevent","playersmax",1,playersmax+1) ;
npc->teleport(101000301);
vector<Player*> players=Maps::info[101000301].Players;
for(unsigned int i=0;i<players.size();i++){
Maps::changeMap(players[i] ,200090000, 0);
}
}
else if(npc->getSelected() == NO){
npc->addText("Oh, Then, I will see you later.");
npc->end();
}
else{
npc->addText("It seems that something is worng with the ship. Contact your admin.");
npc->sendSimple();
npc->end();
}
}
}
 
Status
Not open for further replies.
Back