[Release] Restrict using scrolls inside town Procedure

01/17/2019 09:17 HECKT0R#1
Hello ,
The Procedure below will restrict the using of any scroll to be used only inside towns , otherwise the scroll will give nothing ,also it's enhanced with Notice system to let players knows that such scroll should not be used Outside towns .
Here you go

PHP Code:
use SRO_VT_HECKT0R
go 
create proc _Scroll_Name
Charid int
as
begin

    
Declare @ charname varchar(20), @ isbattle int 
    
    set 
isbattle = (select IsBattleField from SRO_VT_SHARD.dbo._RefRegion where wRegionID =
                    (
Select LatestRegion from SRO_VT_SHARD.dbo._Char where CharID =@ Charid ))

-- 
Check if char ouside town dont tp him for non job cheating and other stuff ... !
    if( @ 
isbattle ='1')
        
begin 
             Insert into Notice 
(Service,Type,Target,Message,Datevalues 
                        
(1,'Private',@ CharName,'sorry but you are not in town :) ',Getdate()) 
        
END
--  End of anti-cheating 
    
else
        
begin
            
print 'Put here the stuff you want from the scroll'
        
end
end 


Press Thanks if it Helps :)
01/17/2019 09:29 facnew#2
Good keep it :o
01/17/2019 10:02 XxGhostSpiriTxX#3
Thanks bro
01/17/2019 10:17 #HB#4
By the way, RegionID column at _Char table can be cheated easily, since it gets updated with the character data packet, so any normal movement will not update the database.
01/17/2019 11:51 Crayon*#5
This whole procedure could be done with single statement.
Code:
 (Select LatestRegion from SRO_VT_SHARD.dbo._Char where CharID in (select charid from SRO_VT_SHARD.._char where charid=@  Charid)))
2k19 "developers" btw :wat:
01/17/2019 11:59 HECKT0R#6
Quote:
Originally Posted by Crayon* View Post
This whole procedure could be done with single statement.
Code:
 (Select LatestRegion from SRO_VT_SHARD.dbo._Char where CharID in (select charid from SRO_VT_SHARD.._char where charid=@  Charid)))
2k19 "developers" btw :wat:

yea it was an old work and it has 3 subquery's inside
decreased it to 2x subquery only , the third subquery was just repeated .. you did not add much but Ty .

PHP Code:
 set isbattle = (select IsBattleField from SRO_VT_SHARD.dbo._RefRegion where wRegionID 
                    (
Select LatestRegion from SRO_VT_SHARD.dbo._Char where CharID =@ Charid )) 
01/17/2019 12:00 putzeimer195#7
I would rather make all this in the Protection instead of Database, if you use his method, every time you use a scroll you have to call this Procedure...
01/17/2019 12:13 HECKT0R#8
Quote:
Originally Posted by putzeimer195 View Post
I would rather make all this in the Protection instead of Database, if you use his method, every time you use a scroll you have to call this Procedure...
ofc it would be better if it was filter sided , but this proc for ppl who asked for it already in other thread and i preferred to create an Release with it since other ppl maybe interested to add it to some of there scrolls procedures.
01/17/2019 21:48 JohnDornel^#9
OP, ever heard of joins?
This does not prevent the scroll from usage, it will still vanish from inventory since you are basing it on SQL. Not to mention you didn't even include how and where this should be used (cuz its release right?).
01/17/2019 22:32 HECKT0R#10
Quote:
Originally Posted by JohnDornel^ View Post
OP, ever heard of joins?
This does not prevent the scroll from usage, it will still vanish from inventory since you are basing it on SQL. Not to mention you didn't even include how and where this should be used (cuz its release right?).
What is the point HERE?
and do you think rewrite same query with joins gotta be hard?lol
Theres comments already inside the procedure should let you understand where and when it should be used , i do not have to give examples for that since theres is something called brain lol, already explains itself.
01/17/2019 23:18 #HB#11
Quote:
Originally Posted by HECKT0R View Post
What is the point HERE?
and do you think rewrite same query with joins gotta be hard?lol
There is a point. Join is way way faster & flexible than that weird code above.

Quote:
Originally Posted by HECKT0R View Post
i do not have to give examples for that since theres is something called brain lol, already explains itself.
Since there's something called a brain, and PPL already can do "join" themselves, then why don't they write the whole code themselves, then what's the usefulness of this topic?
01/18/2019 09:18 HECKT0R#12
Quote:
Originally Posted by #HB View Post
There is a point. Join is way way faster & flexible than that weird code above.



Since there's something called a brain, and PPL already can do "join" themselves, then why don't they write the whole code themselves, then what's the usefulness of this topic?
First of all , lets close some ppl mouths.

HTML Code:
set @isbattle = ( select IsBattleField from SRO_VT_SHARD.dbo._RefRegion R inner JOIN	SRO_VT_SHARD.dbo._Char c  on r.wRegionID=c.LatestRegion where CharID=@CharID )
if you already checked the procedure above you will see the usage of such procedure is already written inside the procedure , AND I DO NOT HAVE TO REWRITE IT TWICE lol!
01/18/2019 12:23 #HB#13
Quote:
Originally Posted by HECKT0R View Post
First of all , lets close some ppl mouses
Mouses? Sorry, I don't get you.

Quote:
Originally Posted by HECKT0R View Post
AND I DO NOT HAVE TO REWRITE IT TWICE lol!
If you're too lazy to write a single statement, then don't share.
01/18/2019 12:41 devdash#14
guys this topic made after i made a question of how to disable a scroll out-the safe zone
and iam pretty begginer, and guess what i completly understood the code
[Only registered and activated users can see links. Click Here To Register...]

so the guy did well, and he helped me, so please guys do not be aggresive to someone trying to help the community, i really apprecaite he's help, and i don't know what does even everything u guys write, but i understand that, he's not kinda feeling bored cuz of this topic, and i don't want someone to feel like that when all he wanted is helping me,

and remember, i just said my opinion no aggressive to anyone, wish the best for all of you.
01/18/2019 13:16 #HB#15
Quote:
Originally Posted by alydandy View Post
so the guy did well, and he helped me, so please guys do not be aggresive to someone trying to help the community
We're not being aggressive, the guy above advised him to use "JOIN" but he replied rudely also kinda boastful.