yoya99 Posted October 10, 2014 Posted October 10, 2014 i have this xp system from castillo and i want to add a text 1. when a player levels up and 2. when a player gets xp . It should be e.g : +2 XP on the left side or like + Level up on the right side here is the code:(a part) function win(ammo, killer, weapon, bodypart) if (killer and getElementType(killer) == "player" and killer ~= source) then local H = getElementData(killer, "XP") or 5 local S = getElementData(killer, "Level") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) local X = 1 setElementData(killer, "XP", tonumber(H)+X) local H = tonumber(H) + X if tonumber(H) == 2 then setElementData(killer, "Level", "Level 1 Reach:10 XP") elseif tonumber(H) == 5 then setElementData(killer, "Level", "Level 2 Reach:15 XP") elseif tonumber(H) == 10 then setElementData(killer, "Level", "Level 3 Reach:25 XP") and here is the code where the dxdrawtext should be added then (i guess) : function getXP ( _, playerName ) if ( playerName ) then local thePlayer = getPlayerFromParticalName ( playerName ) if ( thePlayer ) then local Level = getElementData(thePlayer,"Level") or 0 local XP = getElementData(thePlayer,"XP") or 0 outputChatBox ( getPlayerName ( thePlayer ) .." XP ".. tostring ( XP ) .." LV: ".. tostring ( Level ) .." " ,155,211,216) else outputChatBox ( "Couldn't find '" .. playerName .. "'", source ) end end end addCommandHandler ( "getxp", getXP ) addCommandHandler ( "getXP", getXP ) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end thx in advance And the snail starts to sing
Banex Posted October 10, 2014 Posted October 10, 2014 (edited) edit Edited October 13, 2014 by Guest Not worry about the future. Very soon it will come.
yoya99 Posted October 10, 2014 Author Posted October 10, 2014 you dont understand what i mean.....if i kill soemone and get xp i want it to show a dxdraw text .... like + 1 xp on the side.... And the snail starts to sing
Anubhav Posted October 10, 2014 Posted October 10, 2014 Do it yourself, use dxDrawText See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
yoya99 Posted October 13, 2014 Author Posted October 13, 2014 like that? local sx, sy = guiGetScreenSize ( ) local y = sy + 20 function onLevelup() dxDrawRectangle(sx*(707/1024), sy*(425/768), sx*(115/1024), sy*(27/768), tocolor(44, 44, 44, 221), true) dxDrawText("Rank up+", sx*(716/1024), sy*(429/768), sx*(808/1024), sy*(448/768), tocolor(0, 255, 0, 221), 0.70, "bankgothic", "left", "top", false, false, true, false, false) end function onwin( ) if ( y > ( sy / 2 ) ) then y = y - 2 elseif ( y < ( sy / 2 ) ) then y = ( sy / 2 ) end dxDrawText ( "+"..tostring(experience).." XP", 550, y, sx, 40, tocolor(255, 255, 255, 255), 0.8, "bankgothic") end addEvent("onwin", true) addEventHandler( "onwin", root, function(expe) if not isTimer(expTimer) then expTimer = setTimer(function() removeEventHandler("onClientRender", root, onTestExp) end, 2000, 1) experience = expe addEventHandler("onClientRender", root, win) else experience = (experience + expe) resetTimer(expTimer) end end) And the snail starts to sing
Banex Posted October 13, 2014 Posted October 13, 2014 like that? Test yourself, if not working tell us what errors you have in /debugscript 3 Not worry about the future. Very soon it will come.
yoya99 Posted October 13, 2014 Author Posted October 13, 2014 nothing in debugscript .... help pls And the snail starts to sing
Banex Posted October 13, 2014 Posted October 13, 2014 of course it will not work if some variables are not set and you do not add events to the functions dx Not worry about the future. Very soon it will come.
yoya99 Posted October 13, 2014 Author Posted October 13, 2014 can you show me how? And the snail starts to sing
yoya99 Posted October 19, 2014 Author Posted October 19, 2014 Andy examplefor me pls? And the snail starts to sing
xeon17 Posted October 19, 2014 Posted October 19, 2014 i have this xp system from castillo As far i know the xp system by Castillo is complied or not? A unique GangWar gamemode waiting for you!Click here for more information.
yoya99 Posted October 19, 2014 Author Posted October 19, 2014 In the first update not . no. Now it is. And the snail starts to sing
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