• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

firstitems code

doggi

New Member
Joined
Aug 26, 2008
Messages
30
Reaction score
0
I want to give players items at start but the code seems to be wrong.
Code:

Code:
function onLogin(cid)

  
	if getPlayerVocation(cid) == 5 then	
	  doPlayerAddItem(cid, 2261, 20) -- destroy
	  doPlayerAddItem(cid, 2273, 80) -- uh
	  doPlayerAddItem(cid, 2305, 20) -- ff
        addContainerWithItems(cid, 2002, 2268, 3, 20) -- bp sd
        addContainerWithItems(cid, 2002, 2268, 3, 20) -- bp sd
        addContainerWithItems(cid, 2002, 2268, 3, 20) -- bp sd
        addContainerWithItems(cid, 2002, 2268, 3, 20) -- bp sd
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2003, 2293, 3, 20) -- bp mw
        addContainerWithItems(cid, 2003, 2304, 6, 20) -- bp fireball
        addContainerWithItems(cid, 2003, 2273, 6, 20) -- bp avalanche

	elseif getPlayerVocation(cid) == 6 then	
	  doPlayerAddItem(cid, 2261, 20) -- destroy
	  doPlayerAddItem(cid, 2273, 80) -- uh
	  doPlayerAddItem(cid, 2305, 20) -- ff
        addContainerWithItems(cid, 2002, 2268, 3, 20) -- bp sd
        addContainerWithItems(cid, 2002, 2268, 3, 20) -- bp sd
        addContainerWithItems(cid, 2002, 2268, 3, 20) -- bp sd
        addContainerWithItems(cid, 2002, 2268, 3, 20) -- bp sd
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2000, 7590, 1, 20) -- bp gmp
        addContainerWithItems(cid, 2003, 2293, 3, 20) -- bp mw
        addContainerWithItems(cid, 2003, 2304, 6, 20) -- bp fireball
        addContainerWithItems(cid, 2003, 2273, 6, 20) -- bp avalanche  
        addContainerWithItems(cid, 2002, 2278, 1, 20) -- bp paralyze
   
	elseif getPlayerVocation(cid) == 7 then	
	  doPlayerAddItem(cid, 2261, 20) -- destroy
	  doPlayerAddItem(cid, 2273, 80) -- uh
	  doPlayerAddItem(cid, 2305, 20) -- ff
        addContainerWithItems(cid, 2002, 2268, 3, 20) -- bp sd
        addContainerWithItems(cid, 2002, 2268, 3, 20) -- bp sd
        addContainerWithItems(cid, 2002, 2268, 3, 20) -- bp sd
        addContainerWithItems(cid, 2001, 8472, 1, 20) -- bp gsp
        addContainerWithItems(cid, 2001, 8472, 1, 20) -- bp gsp
        addContainerWithItems(cid, 2001, 8472, 1, 20) -- bp gsp
        addContainerWithItems(cid, 2001, 8472, 1, 20) -- bp gsp
        addContainerWithItems(cid, 2001, 8472, 1, 20) -- bp gsp
        addContainerWithItems(cid, 2001, 8472, 1, 20) -- bp gsp
        addContainerWithItems(cid, 2001, 8472, 1, 20) -- bp gsp
        addContainerWithItems(cid, 2001, 8472, 1, 20) -- bp gsp
        addContainerWithItems(cid, 2001, 8472, 1, 20) -- bp gsp
        addContainerWithItems(cid, 2003, 2293, 3, 20) -- bp mw
        addContainerWithItems(cid, 2003, 2304, 6, 20) -- bp fireball
        addContainerWithItems(cid, 2003, 2273, 6, 20) -- bp avalanche

	elseif getPlayerVocation(cid) == 8 then        
	  doPlayerAddItem(cid, 2261, 20) -- destroy
	  doPlayerAddItem(cid, 2273, 80) -- uh
	  doPlayerAddItem(cid, 2305, 20) -- ff
	  doPlayerAddItem(cid, 2313, 80) -- expo
	  doPlayerAddItem(cid, 2313, 80) -- expo
        addContainerWithItems(cid, 2003, 8473, 1, 20) -- bp uhp
        addContainerWithItems(cid, 2003, 8473, 1, 20) -- bp uhp
        addContainerWithItems(cid, 2003, 8473, 1, 20) -- bp uhp
        addContainerWithItems(cid, 2003, 8473, 1, 20) -- bp uhp
        addContainerWithItems(cid, 2003, 8473, 1, 20) -- bp uhp
        addContainerWithItems(cid, 2003, 8473, 1, 20) -- bp uhp
        addContainerWithItems(cid, 2003, 8473, 1, 20) -- bp uhp
        addContainerWithItems(cid, 2003, 8473, 1, 20) -- bp uhp
        addContainerWithItems(cid, 2003, 8473, 1, 20) -- bp uhp
        addContainerWithItems(cid, 2003, 8473, 1, 20) -- bp uhp
        addContainerWithItems(cid, 2003, 2304, 6, 20) -- bp fireball
        addContainerWithItems(cid, 2003, 2273, 6, 20) -- bp avalanche


        end
    return TRUE
end

eof expected near end..
 
PHP:
function onLogin(cid)
if getPlayerStorageValue(cid, 300) == -1 then
vargotitens = getPlayerVocation(cid)
end
if vargotitens == 1 then
doPlayerAddItem(cid, 2457, 1)
doPlayerAddItem(cid, 2463, 1)
doPlayerAddItem(cid, 2513, 1)
doPlayerAddItem(cid, 2190, 1)
doPlayerAddItem(cid, 2647, 1)
doPlayerAddItem(cid, 2643, 1)
local bag = doPlayerAddItem(cid, 1988, 1)
doAddContainerItem(bag, 5710, 1)
doAddContainerItem(bag, 2120, 1)
doAddContainerItem(bag, 2671, 3)
doAddContainerItem(bag, 2311, 60)
doAddContainerItem(bag, 2287, 60)
doAddContainerItem(bag, 2160, 1)
vargotitens = 5
elseif vargotitens == 2 then
doPlayerAddItem(cid, 2457, 1)
doPlayerAddItem(cid, 2463, 1)
doPlayerAddItem(cid, 2513, 1)
doPlayerAddItem(cid, 2182, 1)
doPlayerAddItem(cid, 2647, 1)
doPlayerAddItem(cid, 2643, 1)
local bag = doPlayerAddItem(cid, 1988, 1)
doAddContainerItem(bag, 5710, 1)
doAddContainerItem(bag, 2120, 1)
doAddContainerItem(bag, 2671, 3)
doAddContainerItem(bag, 2311, 60)
doAddContainerItem(bag, 2287, 60)
doAddContainerItem(bag, 2160, 1)
vargotitens = 5
elseif vargotitens == 3 then
doPlayerAddItem(cid, 2457, 1)
doPlayerAddItem(cid, 2463, 1)
doPlayerAddItem(cid, 2513, 1)
doPlayerAddItem(cid, 2389, 1)
doPlayerAddItem(cid, 2647, 1)
doPlayerAddItem(cid, 2643, 1)
doPlayerAddItem(cid, 2160, 1)
local bag = doPlayerAddItem(cid, 1988, 1)
doAddContainerItem(bag, 5710, 1)
doAddContainerItem(bag, 2120, 1)
doAddContainerItem(bag, 2671, 3)
doAddContainerItem(bag, 2160, 1)
vargotitens = 5
elseif vargotitens == 4 then
doPlayerAddItem(cid, 2457, 1)
doPlayerAddItem(cid, 2463, 1)
doPlayerAddItem(cid, 2513, 1)
doPlayerAddItem(cid, 2383, 1)
doPlayerAddItem(cid, 2647, 1)
doPlayerAddItem(cid, 2643, 1)
local bag = doPlayerAddItem(cid, 1988, 1)
doAddContainerItem(bag, 5710, 1)
doAddContainerItem(bag, 2120, 1)
doAddContainerItem(bag, 2265, 60)
doAddContainerItem(bag, 2273, 60)
doAddContainerItem(bag, 2671, 3)
doAddContainerItem(bag, 2160, 1)
vargotitens = 5
end
if vargotitens == 5 then
setPlayerStorageValue(cid, 300, 1)
end
return TRUE
end
Change this to your liking
 
is there any way to reduce this script with locals.. cuz it's ~ 300 lines of code for 1 character ;/
 
Now my script looks:
Code:
function onLogin(cid)

if getPlayerStorageValue(cid, 300) == -1 then
vargotitens = getPlayerVocation(cid)
end

if vargotitens == 5 then
	  doPlayerAddItem(cid, 2365, 1) -- bp
	  doPlayerAddItem(cid, 2305, 20) -- ff
	  doPlayerAddItem(cid, 2261, 20) -- destroy
	  doPlayerAddItem(cid, 2273, 80) -- uh
	  doPlayerAddItem(cid, 2305, 20) -- ff
	doPlayerBuyItemContainer(cid, 2000, 2268, 1, 0, 3)
	doPlayerBuyItemContainer(cid, 2000, 2268, 1, 0, 3)
	doPlayerBuyItemContainer(cid, 2000, 2268, 1, 0, 3)
	doPlayerBuyItemContainer(cid, 2000, 2268, 1, 0, 3)

	doPlayerBuyItemContainer(cid, 2000, 7590, 1, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 1, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 1, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 1, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 1, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 1, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 1, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 1, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 1, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 1, 0, 1)

	doPlayerBuyItemContainer(cid, 2000, 2304, 1, 0, 6)
	doPlayerBuyItemContainer(cid, 2000, 2274, 1, 0, 6)

	doPlayerBuyItemContainer(cid, 2000, 2293, 1, 0, 3)



vargotitens = 9


elseif vargotitens == 6 then
	  doPlayerAddItem(cid, 2365, 1) -- bp
	  doPlayerAddItem(cid, 2261, 20) -- destroy
	  doPlayerAddItem(cid, 2273, 80) -- uh
	  doPlayerAddItem(cid, 2305, 20) -- ff
	doPlayerBuyItemContainer(cid, 2000, 2268, 20, 0, 3)
	doPlayerBuyItemContainer(cid, 2000, 2268, 20, 0, 3)
	doPlayerBuyItemContainer(cid, 2000, 2268, 20, 0, 3)
	doPlayerBuyItemContainer(cid, 2000, 2268, 20, 0, 3)

	doPlayerBuyItemContainer(cid, 2000, 7590, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7590, 20, 0, 1)

	doPlayerBuyItemContainer(cid, 2000, 2304, 20, 0, 6)
	doPlayerBuyItemContainer(cid, 2000, 2274, 20, 0, 6)

	doPlayerBuyItemContainer(cid, 2000, 2293, 20, 0, 3) 
	doPlayerBuyItemContainer(cid, 2000, 2278, 20, 0, 1)

vargotitens = 9

elseif vargotitens == 7 then
	  doPlayerAddItem(cid, 2365, 1) -- bp
	  doPlayerAddItem(cid, 2261, 20) -- destroy
	  doPlayerAddItem(cid, 2273, 80) -- uh
	  doPlayerAddItem(cid, 2305, 20) -- ff
	doPlayerBuyItemContainer(cid, 2000, 2268, 20, 0, 3)
	doPlayerBuyItemContainer(cid, 2000, 2268, 20, 0, 3)
	doPlayerBuyItemContainer(cid, 2000, 2268, 20, 0, 3)

	doPlayerBuyItemContainer(cid, 2000, 8472, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8472, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8472, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8472, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8472, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8472, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8472, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8472, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8472, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8472, 20, 0, 1)

	doPlayerBuyItemContainer(cid, 2000, 2304, 20, 0, 6)
	doPlayerBuyItemContainer(cid, 2000, 2274, 20, 0, 6)

	doPlayerBuyItemContainer(cid, 2000, 2293, 20, 0, 3)


vargotitens = 9

elseif vargotitens == 8 then
	  doPlayerAddItem(cid, 2365, 1) -- bp
  doPlayerAddItem(cid, 2261, 20) -- destroy
	  doPlayerAddItem(cid, 2273, 80) -- uh
	  doPlayerAddItem(cid, 2305, 20) -- ff
	  doPlayerAddItem(cid, 2313, 80) -- expo
	  doPlayerAddItem(cid, 2313, 80) -- expo
	doPlayerBuyItemContainer(cid, 2000, 8473, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8473, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8473, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8473, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8473, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8473, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8473, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8473, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8473, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 8473, 20, 0, 1)

	doPlayerBuyItemContainer(cid, 2000, 7620, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7620, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7620, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7620, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7620, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7620, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7620, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7620, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7620, 20, 0, 1)
	doPlayerBuyItemContainer(cid, 2000, 7620, 20, 0, 1)

	doPlayerBuyItemContainer(cid, 2000, 2304, 20, 0, 6)
	doPlayerBuyItemContainer(cid, 2000, 2274, 20, 0, 6)


vargotitens = 9
end
if vargotitens == 9 then
setPlayerStorageValue(cid, 300, 1)
end
return TRUE
end

but when i log i got a lot bacpacks on the ground not in the eq :(
 
Back
Top