Xierra Posted June 23, 2010 Share Posted June 23, 2010 (edited) Hello guys, So here's another assignment for my Alternate HUD, I want to make custom wanted stars, like in SAES server. Edit: Look at the most recent post for updates. Edited June 23, 2010 by Guest Link to comment
dzek (varez) Posted June 23, 2010 Share Posted June 23, 2010 get PNG from here ;P http://www.google.com/images?client=ope ... d=0CCUQpwU Link to comment
Xierra Posted June 23, 2010 Author Share Posted June 23, 2010 Ok, thanks. But I need a good white PNG police star. Link to comment
50p Posted June 23, 2010 Share Posted June 23, 2010 I wanted to create such resource one day but I gave up before I even started lol. So, here are 2 png that I planned to use. (If I remember rightly, this white star is 70% transparent. If you need 100% say so) Link to comment
Xierra Posted June 23, 2010 Author Share Posted June 23, 2010 (edited) Well nice work again 50p! Edit: Finished making the location of its own. Preview of the image (not scripted) So the wanted star will look like that, bottom to highest. How I want it to work: Get the wanted value. If the wanted is 1, then set the r,g,b,a of the bottom star to 255,255,255,200. The rest is 0,0,0,100, and vice versa. So on the preview, it's 5 stars. One of the star on the top is inactive. I'll try to work on the script first... Edited June 23, 2010 by Guest Link to comment
Xierra Posted June 23, 2010 Author Share Posted June 23, 2010 So here's the update I've done: (Client-side script) 1. results given here: (On variables line, there is one variable added) -- Weapon tables for ammo. local noreloadweapons = {} --Weapons that doesn't reload (including the flamethrower, minigun, which doesn't have reload anim). noreloadweapons[16] = true noreloadweapons[17] = true noreloadweapons[18] = true noreloadweapons[19] = true noreloadweapons[25] = true noreloadweapons[33] = true noreloadweapons[34] = true noreloadweapons[35] = true noreloadweapons[36] = true noreloadweapons[37] = true noreloadweapons[38] = true noreloadweapons[39] = true noreloadweapons[41] = true noreloadweapons[42] = true noreloadweapons[43] = true local meleespecialweapons = {} --Weapons that don't shoot, and special weapons. meleespecialweapons[0] = true meleespecialweapons[1] = true meleespecialweapons[2] = true meleespecialweapons[3] = true meleespecialweapons[4] = true meleespecialweapons[5] = true meleespecialweapons[6] = true meleespecialweapons[7] = true meleespecialweapons[8] = true meleespecialweapons[9] = true meleespecialweapons[10] = true meleespecialweapons[11] = true meleespecialweapons[12] = true meleespecialweapons[13] = true meleespecialweapons[14] = true meleespecialweapons[15] = true meleespecialweapons[40] = true meleespecialweapons[44] = true meleespecialweapons[45] = true meleespecialweapons[46] = true function DXdraw() --Variables sWidth, sHeight = guiGetScreenSize() health = getElementHealth( getLocalPlayer() ) lineLength1 = 114 * ( health / 100 ) -- Health bar armor = getPedArmor( getLocalPlayer() ) lineLength2 = 114 * ( armor / 100 ) -- Armor bar ammoinclip = getPedAmmoInClip (getLocalPlayer()) totalammo = getPedTotalAmmo (getLocalPlayer()) showammo1 = ammoinclip showammo2 = totalammo moneycount=getPlayerMoney(getLocalPlayer()) money= '$' ..moneycount -- Get the player's money local hour, mins = getTime () time = hour.. ':' ..mins -- Get GTA SA time local wantedlevel = getPlayerWantedLevel (getLocalPlayer()) --Getting the player's wanted level. -- End of variables line. -- first draw the stuff which is visible at all times dxDrawRectangle(sWidth-206,sHeight-43,lineLength2,14.0,tocolor(200,200,200,200),false) -- Armor active bar dxDrawRectangle(sWidth-206,sHeight-23,114.0,14.0,tocolor(50,0,0,150),false) -- Health inactive bar dxDrawRectangle(sWidth-206,sHeight-43,114.0,14.0,tocolor(50,50,50,150),false) -- Armor inactive bar dxDrawRectangle(sWidth-206,sHeight-23,lineLength1,14.0,tocolor(175,0,0,200),false) --Health active bar dxDrawRectangle(sWidth-84,sHeight-48,78.0,33.0,tocolor(0,0,0,150),false) -- GTA Time DX Rectangle dxDrawText(tostring (money),sWidth-200,sHeight-78,sWidth-5,sHeight-54,tocolor(0,0,0,200),1.0,"pricedown","right","top",false,false,false) -- Money DX text (shadow) dxDrawText(tostring (money),sWidth-202,sHeight-81,sWidth-7,sHeight-57,tocolor(0,100,0,220),1.0,"pricedown","right","top",false,false,false) -- Money DX text dxDrawText(tostring (time),sWidth-81,sHeight-46,sWidth-10,sHeight-16,tocolor(250,250,250,200),1.0,"diploma","center","top",false,false,false) -- GTA Time DX text local weaponID = getPedWeapon (getLocalPlayer()); -- Get weapon ID dxDrawImage(sWidth-266,sHeight-56,48.0,52.0,"icons/".. tostring( weaponID ) .. ".png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Weapon icons image. -- now decide if the optional stuff should be drawn if noreloadweapons [getPedWeapon(getLocalPlayer())] then dxDrawText(tostring (showammo2),sWidth-400,sHeight-42,sWidth-288,sHeight-12,tocolor(0,255,255,200),1.0,"bankgothic","right","top",false,false,false) -- No reload weapons (for shotgun, grenades, etc) elseif meleespecialweapons [getPedWeapon(getLocalPlayer())] then -- Draw Nothing for melee and special weapons. else --Weapons that reloads. dxDrawText(tostring (showammo1),sWidth-455,sHeight-41,sWidth-387,sHeight-13,tocolor(0,255,255,200),1.0,"bankgothic","right","top",false,false,false) dxDrawText("|",sWidth-381,sHeight-42,sWidth-366,sHeight-8,tocolor(255,200,0,200),1.0,"bankgothic","left","top",false,false,false) dxDrawText(tostring (showammo2),sWidth-365,sHeight-41,sWidth-272,sHeight-12,tocolor(0,255,255,200),1.0,"bankgothic","left","top",false,false,false) -- Wanted level DX images if wantedlevel = 0 then -- Draw nothing (Wanted level 0) elseif wantedlevel = 1 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 1 elseif wantedlevel = 2 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 2 dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) elseif wantedlevel = 3 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 3 dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) elseif wantedlevel = 4 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 4 dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) elseif wantedlevel = 5 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 5 dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) else dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 6 dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) end end end addEventHandler("onClientRender", getRootElement(), DXdraw) So what's happened here is that the script makes an error: [string = "alternate_hud\client.lua"]:101: "then" expected near "=". Anybody knows how to fix this? Link to comment
50p Posted June 23, 2010 Share Posted June 23, 2010 If you compare variables/strings/numbers/etc., you use 2 equal signs (==) not 1 (=), because 1 is used to set new value to a variable. Link to comment
Xierra Posted June 23, 2010 Author Share Posted June 23, 2010 Thanks! It's working at last. Gonna be released soon as V 1.3! I'll credit you again, 50p, for the most number of helps on this script. Edit: Wait a sec, what is the HUD component name for wanted stars? Link to comment
50p Posted June 23, 2010 Share Posted June 23, 2010 Thanks! It's working at last.Gonna be released soon as V 1.3! I'll credit you again, 50p, for the most number of helps on this script. I'll help you again with your time lol Well, I don't like to see a number of minutes without an extra 0 at the front if number of minutes is less then 10 (like 2:5, when it's 2:05). time = hours .. ":" .. (((mins < 10) and "0"..mins) or mins) Link to comment
Xierra Posted June 23, 2010 Author Share Posted June 23, 2010 Ok, I'll change it, maybe looks good with that. Now what's the HUD component name for wanted stars? Link to comment
50p Posted June 23, 2010 Share Posted June 23, 2010 Ok, I'll change it, maybe looks good with that.Now what's the HUD component name for wanted stars? I suppose there is none. If there isn't one on wiki then there isn't. Link to comment
Xierra Posted June 24, 2010 Author Share Posted June 24, 2010 Aww, then how SAES server hide them up... Maybe custom wanted functions? Anybody knows if there is a way to hide wanted stars HUD? Link to comment
50p Posted June 24, 2010 Share Posted June 24, 2010 I suppose they use a custom function because you don't see any stars when your wanted level is at 0. Link to comment
MaddDogg Posted June 24, 2010 Share Posted June 24, 2010 I justed tested every hud component and no, the wanted stars can't be deactivated. But, as 50p said, they are not shown, as long as you don't set the wanted level > 0. So you should just write your own wanted function, which does not rely on the setPlayerWantedLevel function. Link to comment
50p Posted June 24, 2010 Share Posted June 24, 2010 The only downside of making your custom functions is that only you will use them.. I mean, other scripts will use setPlayerWantedLevel so the custom stars will be useless but if you run it on your own server you will be fine. You can export these functions and let other resources use them but other scripts which use setPlayerWantedLevel would have to be changed to use the exported functions instead. Link to comment
Xierra Posted June 24, 2010 Author Share Posted June 24, 2010 I know, I must make my own wanted functions if hiding wanted HUD is impossible for now. Alright then, I'll cancel that one, unless the SAES Server if inspired, simply look at the wanted functions (but dunno where it is) and follow it! Topic ends here. Link to comment
50p Posted June 24, 2010 Share Posted June 24, 2010 It's not hard to make your own wanted level functions... Don't give up that easily because you'll never make a script that you dream of. Just use element data to indicate the wanted level. You can then just use getElementData to get his wanted level and show specific amount of stars. I think element data would be good enough for it.. You won't even have to export any functions because element data is shared by entire server and all resources can use getElementData to get the data that was set by other resource. So, don't give up. Link to comment
Xierra Posted June 25, 2010 Author Share Posted June 25, 2010 (edited) Good idea, I never looked at getElementData though, I'll go and learn it out. *Edit* Well now it's reborn! Check out the next posts. Edited November 16, 2010 by Guest Link to comment
Xierra Posted November 15, 2010 Author Share Posted November 15, 2010 Sorry for the big bump, but looks like Gangsta RPG needs custom wanted stars script. So yeah this time there's a chance if it's only available for one server... So how would the script look like? My idea is: There are ranges between 0 - 20001st wanted star is made if range of crime is 100 2nd wanted star is made if range of crime is 250 3rd wanted star is made if range of crime is 500 4th wanted star is made if range of crime is 800 5th wanted star is made if range of crime is 1250 6th wanted star is made if range of crime is 2000~ Stealing a car makes 50Speeding makes 2 per second. Punching someone makes 5 Punching a police alerts and makes 1 star Shooting someone makes 10 Shooting a police alerts and makes 1 star Killing someone makes 100, 50 when 3 star or up Killing a police makes 200, 75 when 3 star or up Exploding a car makes 100 Exploding a police car makes 200, 100 when 3 star or up What do you think? Anybody could give better calculations? Can anybody give an example on how to make it? Link to comment
Pistolebob Posted November 15, 2010 Share Posted November 15, 2010 (edited) I'm also going to make a wanted level, I can post some code here when I get home. When someone enters a car, that he/she does not own, the script should setElementData (player, "wantedlevel", value) to the old value + 30 for example. Edited November 15, 2010 by Guest Link to comment
Static-X Posted November 15, 2010 Share Posted November 15, 2010 XX3, all you need to do is to create the gui and make the starts appear on element data change, you can use wasted event to set the wanted data of the player. Link to comment
Xierra Posted November 16, 2010 Author Share Posted November 16, 2010 (edited) Thanks buddy! I'll give it a try. Hmm, now here's my question: How do I get player's data and their crime range element data? Cause I'm still a beginner in scripting, sorry about that. After I am able to do the ones above, there will be wanted stars, something like this: function wantedstars() wantedlevel = getElementData (crimerange) -- Wanted level DX images if wantedlevel <100 then -- Draw nothing (Wanted level 0) elseif wantedlevel >=100 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 1 elseif wantedlevel >=250 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 2 dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) elseif wantedlevel >=500 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 3 dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) elseif wantedlevel >=1000 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 4 dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) elseif wantedlevel >=2000 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 5 dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) elseif wantedlevel>=4000 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 6 dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) else outputChatBox("Invalid data") end (Where's the LUA tags? O_o) Sorry Static-X, I'm editing while you posted it. I didn't think that would work. You should store the player's data (so when the player joins again, the crime range stays). It's an RPG, that's why. Edited November 16, 2010 by Guest Link to comment
Static-X Posted November 16, 2010 Share Posted November 16, 2010 Good luck, here is an example. ( don't know if has any error ) star1= guiCreateStaticImage( x, y, w, h, "stars.png", false ) star2= guiCreateStaticImage( x, y, w, h, "stars.png", false ) star3= guiCreateStaticImage( x, y, w, h, "stars.png", false ) star4= guiCreateStaticImage( x, y, w, h, "stars.png", false ) star5= guiCreateStaticImage( x, y, w, h, "stars.png", false ) star6= guiCreateStaticImage( x, y, w, h, "stars.png", false ) function onResourceStart() setElementData(getLocalPlayer(),"wantedLevel",0) end addEventHandler("onClientResourceStart",root,onResourceStart) addEventHandler ( "onClientElementDataChange", getRootElement(), function ( data ) data = "wantedLevel" if (getElementData(getLocalPlayer(),"wantedLevel")==1) then guiSetVisible(star1,true) end end ) Link to comment
Xierra Posted November 17, 2010 Author Share Posted November 17, 2010 Just to keep it on top, any way around from my previous post? Link to comment
Static-X Posted November 17, 2010 Share Posted November 17, 2010 Try this, function onResourceStart() setElementData(getLocalPlayer(),"crimerange",0) -- first of all you are going to set the data when the client resource starts end addEventHandler("onClientResourceStart",getLocalPlayer(),onResourceStart) function wantedstars() wantedlevel = getElementData (getLocalPlayer(),"crimerange") if wantedlevel >=100 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 1 elseif wantedlevel >=250 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 2 dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) elseif wantedlevel >=500 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 3 dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) elseif wantedlevel >=1000 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 4 dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) elseif wantedlevel >=2000 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 5 dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) elseif wantedlevel>=4000 then dxDrawImage(1003.0,556.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Wanted level 6 dxDrawImage(1003.0,578.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,600.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,620.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,642.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(1003.0,663.0,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) else outputDebugString("Invalid data") end end addEventHandler ( "onClientElementDataChange", getRootElement(),wantedstars ) For saving the data you can use, (SERVER SIDED= -- saving function save() if not (isGuestAccount(source)) then local Wanteddata = getElementData(source,"crimerange") setAccountData(getPlayerAccount(source),"wantedLevel",Wanteddata ) end end addEventHandler("onPlayerQuit",getRootElement(),save) addEventHandler("onPlayerLogout",getRootElement(),save) -- loading function loadit() local Wanteddata = getAccountData(getPlayerAccount(source),"crimerange") setElementData(source,"wantedLevel",Wanteddata ) end addEventHandler("onPlayerLogin",getRootElement(),loadit) An example, how you can make the stars appear. SERVER SIDED: function xx (_,killer,_,_) if (killer) then local Wanteddata = getElementData(killer,"crimerange") setElementData(killer,"crimerange",Wanteddata + 100) -- set the killer's wanted level to current wanted level + 100 setElementData(source,"crimerange",0) -- set the wasted player's wanted level to 0 else setElementData(source,"crimerange",0) -- set the wasted player's wanted level to 0 end end addEventHandler("onPlayerWasted",getRootElement(),xx) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now