Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[SQL] Query to add a new custom Teleport with options very easy and very fast

(⌐■_■)
Joined
Feb 2, 2012
Messages
681
Reaction score
102
hey , this is my textdata_Object.txt Line

1 SN_STORE_PVP_Zone2 ??? ??? ?? ??? 0 0 0 0 0 PVP Area PVP Area 0 0 0 0 0 0

Your Area name in Ref_Teleport

Your Area name which u want to name it ^^


Code:
1	SN_STORE_PVP_Zone2	??? ??? ?? ???	0	0	0	0	0	PVP Area	PVP Area	0	0	0	0	0	0
 
Last edited:
Newbie Spellweaver
Joined
Apr 9, 2012
Messages
67
Reaction score
7
not working with me get this ( SQL2005 )
Code:
Msg 102, Level 15, State 1, Line 26
Incorrect syntax near '('.
Msg 102, Level 15, State 1, Line 26
Incorrect syntax near '+'.
Msg 102, Level 15, State 1, Line 31
Incorrect syntax near '('.
Msg 102, Level 15, State 1, Line 31
Incorrect syntax near '+'.
Msg 137, Level 15, State 2, Line 35
Must declare the scalar variable "@MAXOBJ".
Msg 137, Level 15, State 2, Line 40
Must declare the scalar variable "@MAXOBJ".
Msg 137, Level 15, State 2, Line 50
Must declare the scalar variable "@LINK".
Msg 102, Level 15, State 1, Line 53
Incorrect syntax near '('.
Msg 102, Level 15, State 1, Line 53
Incorrect syntax near '+'.
Msg 102, Level 15, State 1, Line 54
Incorrect syntax near '('.
Msg 137, Level 15, State 2, Line 61
Must declare the scalar variable "@MAXTELID".
Msg 137, Level 15, State 2, Line 65
Must declare the scalar variable "@MAXTELID".
Msg 137, Level 15, State 2, Line 72
Must declare the scalar variable "@MAXTELID".
Msg 137, Level 15, State 2, Line 74
Must declare the scalar variable "@MAXTELID".
Msg 137, Level 15, State 2, Line 78
Must declare the scalar variable "@MAXTELID".
Msg 137, Level 15, State 2, Line 79
Must declare the scalar variable "@MAXTELID".
Msg 137, Level 15, State 2, Line 84
Must declare the scalar variable "@MAXTELID".
Msg 137, Level 15, State 2, Line 89
Must declare the scalar variable "@MAXTELID".
 
Last edited:
Newbie Spellweaver
Joined
Jul 8, 2012
Messages
20
Reaction score
6
thank you because you are trying to help people, but I have a problem with this query when I put everything in the media and everything is true and correct and spaces also but when go to the teleport get crash, so you can fix this?
 
Skilled Illusionist
Joined
Apr 1, 2012
Messages
324
Reaction score
9
i tried and i get :

Msg 8106, Level 16, State 1, Line 33
Table '_RefObjCommon' does not have the identity property. Cannot perform SET operation.

so i did :

from SQL menu >> tools >> options >> designers then un-check "prevent saving changes that required table re-creation" then go to
_refobjcommon table > right click > design
set ID as primary key (right click > set as primary key) and from the properties at bottom set identity to "YES"

but then when save i get :

'_RefObjCommon' table
- Unable to create index 'PK__RefObjCommon_1'.
The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo._RefObjCommon' and the index name 'PK__RefObjCommon_1'. The duplicate key value is (41951).
Could not create constraint. See previous errors.
The statement has been terminated.

Hope some1 can helpme ! Thanks :-/
 
Last edited:
Skilled Illusionist
Joined
Apr 1, 2012
Messages
324
Reaction score
9
Muahahaha ! WORK 100% Thanks Alot dude !! ur a pro ! <3 Kiss > ArabianFox
 
Newbie Spellweaver
Joined
Jul 8, 2012
Messages
20
Reaction score
6
thank you because you are trying to help people, but I have a problem with this query when I put everything in the media and everything is true and correct and spaces also but when go to the teleport get crash, so you can fix this?

any fix for my problem?..
 
Master Summoner
Joined
Nov 9, 2009
Messages
579
Reaction score
238
not working with me get this ( SQL2005 )
Code:
Msg 102, Level 15, State 1, Line 26
Incorrect syntax near '('.
Msg 102, Level 15, State 1, Line 26
Incorrect syntax near '+'.
Msg 102, Level 15, State 1, Line 31
Incorrect syntax near '('.
Msg 102, Level 15, State 1, Line 31
Incorrect syntax near '+'.
Msg 137, Level 15, State 2, Line 35
Must declare the scalar variable "@MAXOBJ".
Msg 137, Level 15, State 2, Line 40
Must declare the scalar variable "@MAXOBJ".
Msg 137, Level 15, State 2, Line 50
Must declare the scalar variable "@LINK".
Msg 102, Level 15, State 1, Line 53
Incorrect syntax near '('.
Msg 102, Level 15, State 1, Line 53
Incorrect syntax near '+'.
Msg 102, Level 15, State 1, Line 54
Incorrect syntax near '('.
Msg 137, Level 15, State 2, Line 61
Must declare the scalar variable "@MAXTELID".
Msg 137, Level 15, State 2, Line 65
Must declare the scalar variable "@MAXTELID".
Msg 137, Level 15, State 2, Line 72
Must declare the scalar variable "@MAXTELID".
Msg 137, Level 15, State 2, Line 74
Must declare the scalar variable "@MAXTELID".
Msg 137, Level 15, State 2, Line 78
Must declare the scalar variable "@MAXTELID".
Msg 137, Level 15, State 2, Line 79
Must declare the scalar variable "@MAXTELID".
Msg 137, Level 15, State 2, Line 84
Must declare the scalar variable "@MAXTELID".
Msg 137, Level 15, State 2, Line 89
Must declare the scalar variable "@MAXTELID".

Hey, take the version below i fixed it for MSSQL 2005, its working like a charm, thanks arabianfox :D

PHP:
USE SRO_VT_SHARD /* Add new Teleport By Arabianfox // Fixed for SQL2005 by LemoniscooL*/


DECLARE @Teleport VARCHAR (64)
DECLARE @CHARNAME1 VARCHAR (30)
DECLARE @CHARNAME2 VARCHAR (30)
DECLARE @OwnTeleport INT
DECLARE @Fee INT
DECLARE @RequiredLVL INT

/* Put your settings here */
SET @Teleport = 'NAME' -- any name you want ex: PK_ZONE or PVP_ZONE
SET @CHARNAME1 = 'CHARACTER1' -- Teleport position
SET @CHARNAME2 = 'CHARACTER2' -- Spawn position after teleport
SET @OwnTeleport = 1  -- Target teleport ID ex: 1 for Jangan - 5 for Hotan - 20 for Constantinople
SET @Fee = 50000  -- Gold amount to Pass the teleport
SET @RequiredLVL = 0  -- minimum level required to teleport 0 for no restriction - ex:90 lvl 90 and higher can teleport
/* settings area end here */

IF EXISTS (SELECT CodeName128 FROM _RefObjCommon WHERE CodeName128 = 'STORE_'+@Teleport)
 BEGIN
  raiserror('The stated teleportname of %s is already exist!',11,1,@Teleport);
  RETURN;
 END
    
    DECLARE @MAXOBJ INT
	SET @MAXOBJ = (SELECT MAX (ID) FROM _RefObjCommon)+1
    DECLARE @REGION1 INT
	SET @REGION1 = (SELECT (LatestRegion) FROM _Char WHERE CharName16 = @CHARNAME1)
    DECLARE @POSX1 INT
	SET @POSX1 = (SELECT (POSX) FROM _Char WHERE CharName16 = @CHARNAME1)
    DECLARE @POSY1 INT
	SET @POSY1 = (SELECT (POSY) FROM _Char WHERE CharName16 = @CHARNAME1)
    DECLARE @POSZ1 INT
	SET @POSZ1 = (SELECT (POSZ) FROM _Char WHERE CharName16 = @CHARNAME1)
    DECLARE @LINK INT
	SET @LINK = (SELECT MAX (ID) FROM _RefObjStruct)+1
     
	SET IDENTITY_INSERT _RefObjCommon ON
    INSERT INTO _RefObjCommon (Service,ID,CodeName128,ObjName128,OrgObjCodeName128,NameStrID128,DescStrID128,CashItem,Bionic,TypeID1,TypeID2,TypeID3,TypeID4,DecayTime,Country,Rarity,CanTrade,CanSell,CanBuy,CanBorrow,CanDrop,CanPick,CanRepair,CanRevive,CanUse,CanThrow,Price,CostRepair,CostRevive,CostBorrow,KeepingFee,SellPrice,ReqLevelType1,ReqLevel1,ReqLevelType2,ReqLevel2,ReqLevelType3,ReqLevel3,ReqLevelType4,ReqLevel4,MaxContain,RegionID,Dir,OffsetX,OffsetY,OffsetZ,Speed1,Speed2,Scale,BCHeight,BCRadius,EventID,AssocFileObj128,AssocFileDrop128,AssocFileIcon128,AssocFile1_128,AssocFile2_128,Link) VALUES
    (1,@MAXOBJ,'STORE_'+@Teleport,@Teleport,'xxx','SN_STORE_'+@Teleport,'xxx',0,0,4,1,1,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,-1,0,-1,0,-1,0,-1,@REGION1,0,@POSX1,@POSY1,@POSZ1,0,0,50,50,30,0,'quest\teleport01.bsr','xxx','xxx','xxx','xxx',@link)
    SET IDENTITY_INSERT _RefObjCommon OFF
	
	print ''
	print 'Add the following line to teleportbuilding.txt @server_dep\silkroad\textdata folder'
    print '1	'+CONVERT(varchar(max),@MAXOBJ)+'	'+'STORE_'+@Teleport+'	'+@Teleport+'	xxx	'+'SN_STORE_'+@Teleport+'	xxx	0	0	4	1	1	0	0	3	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	-1	0	-1	0	-1	0	-1	0	-1	'+CONVERT(varchar(max),@REGION1)+'	0	'+CONVERT(varchar(max),@POSX1)+'	'+CONVERT(varchar(max),@POSY1)+'	'+CONVERT(varchar(max),@POSZ1)+'	0	0	50	50	30	0	quest\teleport01.bsr	xxx	xxx	xxx	xxx	'+CONVERT(varchar(max),@link)
	print ''
	print 'Add the following line to textdata_object.txt @server_dep\silkroad\textdata folder'
	print ''
	print '1	'+'SN_STORE_'+@Teleport+'								'+@Teleport
	print ''
  	print ''

  SET IDENTITY_INSERT _RefObjStruct ON
  INSERT INTO _RefObjStruct (ID,Dummy_Data) VALUES
  (@LINK,0)
  SET IDENTITY_INSERT _RefObjStruct OFF
  
  DECLARE @MAXTELID INT
  SET @MAXTELID = (SELECT MAX (ID) FROM _RefTeleport)+1
  DECLARE @WORLDID INT
  SET @WORLDID = (SELECT (WorldID) FROM _Char where CharName16 = @CHARNAME2)
  DECLARE @REGION2 INT
  SET @REGION2 = (SELECT (LatestRegion) FROM _Char WHERE CharName16 = @CHARNAME2)
  DECLARE @POSX2 INT
  SET @POSX2 = (SELECT (POSX) FROM _Char WHERE CharName16 = @CHARNAME2)
  DECLARE @POSY2 INT
  SET @POSY2 = (SELECT (POSY) FROM _Char WHERE CharName16 = @CHARNAME2)
  DECLARE @POSZ2 INT
  SET @POSZ2 = (SELECT (POSZ) FROM _Char WHERE CharName16 = @CHARNAME2)

  SET IDENTITY_INSERT _RefTeleport ON
  INSERT INTO _RefTeleport (Service,ID,CodeName128,AssocRefObjCodeName128,AssocRefObjID,ZoneName128,GenRegionID,GenPos_X,GenPos_Y,GenPos_Z,GenAreaRadius,CanBeResurrectPos,CanGotoResurrectPos,GenWorldID,BindInteractionMask,FixedService) VALUES
  (1,@MAXTELID,'GATE_'+@Teleport,'STORE_'+@Teleport,@MAXOBJ,'SN_STORE_'+@Teleport,@REGION2,@POSX2,@POSY2,@POSZ2,30,0,0,@WORLDID,1,0)
  SET IDENTITY_INSERT _RefTeleport OFF

  print ''
  print 'Add the following line to teleportdata.txt @server_dep\silkroad\textdata folder'
  print '1	'+CONVERT(varchar(max),@MAXTELID)+'	'+'GATE_'+@Teleport+'	'+CONVERT(varchar(max),@MAXOBJ)+'	'+'SN_STORE_'+@Teleport+'	'+CONVERT(varchar(max),@REGION2)+'	'+CONVERT(varchar(max),@POSX2)+'	'+CONVERT(varchar(max),@POSY2)+'	'+CONVERT(varchar(max),@POSZ2)+'	30	0	0	'+CONVERT(varchar(max),@WORLDID)+'	1	0'
  print ''
  print ''

  IF @RequiredLVL = 0
  BEGIN
    INSERT INTO _RefTeleLink (Service,OwnerTeleport,TargetTeleport,Fee,RestrictBindMethod,RunTimeTeleportMethod,CheckResult,Restrict1,Data1_1,Data1_2,Restrict2,Data2_1,Data2_2,Restrict3,Data3_1,Data3_2,Restrict4,Data4_1,Data4_2,Restrict5,Data5_1,Data5_2) VALUES
    (1,@OwnTeleport,@MAXTELID,@Fee,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
	INSERT INTO _RefTeleLink (Service,OwnerTeleport,TargetTeleport,Fee,RestrictBindMethod,RunTimeTeleportMethod,CheckResult,Restrict1,Data1_1,Data1_2,Restrict2,Data2_1,Data2_2,Restrict3,Data3_1,Data3_2,Restrict4,Data4_1,Data4_2,Restrict5,Data5_1,Data5_2) VALUES
    (1,@MAXTELID,@OwnTeleport,@Fee,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
	
print ''
	print 'Add the following lines to teleportlink.txt @server_dep\silkroad\textdata folder'
    print '1	'+CONVERT(varchar(max),@OwnTeleport)+'	'+CONVERT(varchar(max),@MAXTELID)+'	'+CONVERT(varchar(max),@Fee)+'	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0'
    print '1	'+CONVERT(varchar(max),@MAXTELID)+'	'+CONVERT(varchar(max),@OwnTeleport)+'	'+CONVERT(varchar(max),@Fee)+'	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0'
	print ''
  END
  ELSE BEGIN
	INSERT INTO _RefTeleLink (Service,OwnerTeleport,TargetTeleport,Fee,RestrictBindMethod,RunTimeTeleportMethod,CheckResult,Restrict1,Data1_1,Data1_2,Restrict2,Data2_1,Data2_2,Restrict3,Data3_1,Data3_2,Restrict4,Data4_1,Data4_2,Restrict5,Data5_1,Data5_2) VALUES
    (1,@OwnTeleport,@MAXTELID,@Fee,0,0,0,1,@RequiredLVL,999,0,0,0,0,0,0,0,0,0,0,0,0)
	
	print ''
	print ''
	print 'Add the following line to teleportlink.txt @server_dep\silkroad\textdata folder'
	print '1	'+CONVERT(varchar(max),@OwnTeleport)+'	'+CONVERT(varchar(max),@MAXTELID)+'	'+CONVERT(varchar(max),@Fee)+'	0	0	0	1	'+CONVERT(varchar(max),@RequiredLVL)+'	999	0	0	0	0	0	0	0	0	0	0	0	0'
    print ''

  END

print ''
print 'Done!'
 
Skilled Illusionist
Joined
Jan 5, 2012
Messages
332
Reaction score
7
Help for if i Teleport To Room Unique My Client Have Crash
 
Newbie Spellweaver
Joined
Dec 28, 2011
Messages
47
Reaction score
4
Nice Working but I have problem to go to back when I click teleport there's no entry to go back clean :S
 
Newbie Spellweaver
Joined
Oct 14, 2011
Messages
75
Reaction score
26
MSSQL 2005 dont work but the for the Query ;)

Code:
Msg 8106, Level 16, State 1, Line 39
Table '_RefObjCommon' does not have the identity property. Cannot perform SET operation.169841
 
Experienced Elementalist
Joined
Jun 21, 2012
Messages
208
Reaction score
17
Msg 515, Level 16, State 2, Line 60
Cannot insert the value NULL into column 'GenRegionID', table 'SRO_VT_SHARD.dbo._RefTeleport'; column does not allow nulls. INSERT fails.

why this error
 
Newbie Spellweaver
Joined
Jul 14, 2012
Messages
73
Reaction score
4
MSSQL 2005 dont work but the for the Query ;)

Code:
Msg 8106, Level 16, State 1, Line 39
Table '_RefObjCommon' does not have the identity property. Cannot perform SET operation.169841

How can i Fix this error ??? i have MySql 2005

and adminsxza just check the colum GenRegionID and add allow NULL
 
Newbie Spellweaver
Joined
Jul 14, 2012
Messages
73
Reaction score
4
hello can u please make a tut step by step without this master query ? please :)
 
Newbie Spellweaver
Joined
May 26, 2012
Messages
50
Reaction score
0
i get this
and if i click nothing happens
X6GmZ - [SQL] Query to add a new custom Teleport with options very easy and very fast - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Back
Top