Help with Job Reward

10/15/2015 04:16 putzeimer195#1
Hello Guys,

I tried to use this Job Reward
Quote:
IF @EventID = 97 or EventID =91 and Data1=2 or EventID =91 and Data1=3
begin
DECLARE @TradeDifficulty INT,
@REWARDCOUNT INT,
@REQLEVEL TINYINT,
@Contribution int,
@RewardCode varchar(max),
@CharName varchar(max)
set @rewardcode = 'REWARD_ITEM_CODE'
set @charname = (select charname16 from shard.._char where charid = @charid)
Set @Contribution = (select contribution from shard.._chartrijob where charid = @charid)
set @RewardCount = '20' /* coin or silk amount */
set @reqLevel = (select curlevel from shard.._char where charid = @charid)
set @difficulty = case
When @contribution between 'lowest 5 star contribution' and 'highest 5 star contribution'
then 5
else 1
end
if @difficulty = 5 and @reqlevel = 100 /* 5 star and cur level = 100 */
begin
update shard.._charcos set ownercharid = 0,refcharid = 0 where ownercharid = @charid and refcharid in (select id from _refobjcommon where codename128 like '%COS_T%')
exec shard.._add_item_extern @charname,@rewardcode,@Rewardcount,1
end
end
From Lenius

My Problem is, that I get this error:
Quote:
Must declare the scalar variable "@EventID".
Msg 137, Level 15, State 2, Line 10
Must declare the scalar variable "@charid".
Msg 137, Level Msg 137, Level 15, State 2, Line 1
15, State 2, Line 11
Must declare the scalar variable "@charid".
Msg 137, Level 15, State 2, Line 13
Must declare the scalar variable "@charid".
Msg 137, Level 15, State 1, Line 14
Must declare the scalar variable "@difficulty".
Msg 137, Level 15, State 2, Line 19
Must declare the scalar variable "@difficulty".
Msg 137, Level 15, State 2, Line 21
Must declare the scalar variable "@charid".
[Only registered and activated users can see links. Click Here To Register...]

I hope any1 can help me :/

Thanks :)
10/15/2015 06:55 mtnman33#2
under DECLARE put in :
@charid int,
@EventID int,
@difficulty int
and you should be good to go

however you might wanna change all the 'charid' to 'CharID' for easy system recall for any stored procedures you may run with this script , good luck
10/15/2015 12:12 ​Exo#3
PS:- the procedure is shit

I'd not recommend using it.
10/15/2015 13:56 putzeimer195#4
Now i get only this error
Quote:
IF @EventID = 97 or EventID = 91 and Data1=2 or EventID = 91 and Data1=3
begin
DECLARE @TradeDifficulty INT,
@REWARDCOUNT INT,
@REQLEVEL TINYINT,
@Contribution int,
@CharID int,
@EventID int,
@difficulty int,
@RewardCode varchar(max),
@CharName varchar(max)
set @rewardcode = 'ITEM_ETC_ARENA_COIN'
set @charname = (select charname16 from shard.._char where CharID = @CharID)
Set @Contribution = (select contribution from shard.._chartrijob where CharID = @CharID)
set @RewardCount = '20' /* coin or silk amount */
set @reqLevel = (select curlevel from shard.._char where CharID = @CharID)
set @difficulty = case
When @contribution between 'lowest 5 star contribution' and 'highest 5 star contribution'
then 5
else 1
end
if @difficulty = 5 and @reqlevel = 100 /* 5 star and cur level = 100 */
begin
update shard.._charcos set ownercharid = 0,refcharid = 0 where ownercharid = @CharID and refcharid in (select id from _refobjcommon where codename128 like '%COS_T%')
exec shard.._add_item_extern @charname,@rewardcode,@Rewardcount,1
end
end
Error :
Quote:
Msg 137, Level 15, State 2, Line 1
Must declare the scalar variable "@EventID".
10/16/2015 11:12 ​Goofie​#5
And people asking why their Database/files lagging while using shitty queries... :facepalm:
10/20/2015 15:27 Anonymous-6723#6
Code:
IF @EventID = 97 or EventID = 91 and Data1=2 or EventID = 91 and Data1=3
Make that line above to be the same as the one below.
Code:
IF @EventID = 97 or @EventID = 91 and @Data1=2 or @EventID = 91 and @Data1=3

Don't use this! It's crappy coded.