Jump to content

Klesh

Members
  • Posts

    306
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Klesh

  1. Yes i know that, but what i mean is is i add that event the window not will show at playerjoin, so i need to know how i can call 2 functions, one to bind and th other one to show it at serverjoin.
  2. Klesh

    elementData

    Same error on commandHandler, i was copy again.
  3. Klesh

    elementData

    Yes im in a vehicle, here the errors:
  4. Klesh

    elementData

    That's mean you can store data as db or SQLite, with JSON, that good to know, never seen before.(Tables) Edit: The script doesn't save the nitro.
  5. Klesh

    elementData

    Ok, i see on wiki and i read more, i understand that stores data between scripts, you use unpack to extract them on server side, thanks.
  6. Klesh

    elementData

    I didn't understand the toJSON event, how to use and when, can explain because wiki say's something about cats Thanks, i forgot that's a server-side, and setcolorNitro, thanks for that.
  7. Klesh

    elementData

    Hi i try to add some code line to the script shader_nitro to save it when player quit and back nitro when player joins, so this is the whole code: root = getRootElement() addEventHandler("onClientResourceStart",resourceRoot, function() nitroShader = dxCreateShader("nitro.fx") end) -- This function will set the new color of the nitro function updateNitroColor(r,g,b) if nitroShader then if r and g and b then engineApplyShaderToWorldTexture (nitroShader,"smoke") dxSetShaderValue (nitroShader, "gNitroColor", r/255, g/255, b/255 ) end end end -- This function will reset the nitro back to the original function resetNitroColor() if nitroShader then engineRemoveShaderFromWorldTexture(nitroShader,"smoke") end end -- Example command use addCommandHandler("nitro", function nitroPursache(command,r,g,b) if r and g and b then local r,g,b = tonumber(r),tonumber(g),tonumber(b) if r <= 255 and g <= 255 and b <= 255 then updateNitroColor(r,g,b) outputChatBox("Nitro color updated!",255,255,255,true) else outputChatBox("Colors must be between 0 and 255",255,255,255,true) end else resetNitroColor() outputChatBox("Nitro color reset to original!",255,255,255,true) end end) function onPlayerQuit (playerSource) local acc = getPlayerAccount(source) local playerVehicle = getOccupiedVehicle(playerSource) if acc then getPlayerAccount(nitroPursache) setAccountData(acc, "nitro.data", gNitroColor(playerVehicle)) end end addEventHandler("onPlayerQuit", root, onPlayerQuit) function onPlayerLogin () if acc then pNitro = getAccountData(acc, "nitro.data") if pNitro then setgNitroColor( source, gNitroColor ( pNitro ) ) end end end addEventHandler("onPlayerLogin", root, onPlayerJoin) Doesn't save, i dont know how to call nitrocolor function.
  8. Im using the gui to make a window, but the trouble is this, when player join the window appear so i was thinking in bind that winndow for the player, here come the real trouble: This is an example of lua code, the first code i try. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () genWindow() showCursor(true,true) end ) But later i was thinking in bind that window, so i try to do this: function onresourceStart() bindKey("F1", "down", showgenWindow) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) function showgenWindow() genWindow() showCursor(true,true) end I was make the code, when i test it the window not shows when player join, but the bind works fine. I tryed to make with onPlayerJoin, or onPlayerLogin with root but the windows being not show when players join or login, or bind no work. What other way i can make the window show's when player join, with the bind working.
  9. Klesh

    createfont

    Ok thanks for the help, but like as say i will edit the nametag.lua of race, and i did it with the meta and all that, but when i put /debugscript 3 say's "bad file-path @ pointer dxCreateFont. What does mean?
  10. Klesh

    createfont

    It's a question about to create a new font, but i dont understand to much about wiki tutorial, because i need to now if have to export any font in file and put it the meta file, only i ask becuase i need to know to edit race nametag.
  11. Hi community, i try to make a simple script, this script play's a sound with a command, the song play's for all! The code doesn't works. local root = getRootElement () function playXSSoundForPlayer(forAll) if (forAll) then playSound("/music/XS.mp3",false) else if (source == localPlayer) then playSound("/music/XS.mp3",false) else local x,y,z = getElementPosition(source) local sound = playSound3D("/music/XS.mp3",x,y,z,false) setSoundMinDistance(sound,5) setSoundMaxDistance(sound,40) attachElements(sound,source) end end end addEvent("onPlayerPlayXSSound", true) addEventHandler("onPlayerPlayXSSound", root, playXSSoundForPlayer) addCommandHandler( "playsound", playXSSoundForPlayer )
  12. Klesh

    getPlayerTeam

    Checked and tested, i see the error, but the being not save the team, where is the fail? I copy your code! Not saved!
  13. Klesh

    getPlayerTeam

    The player not saves the team, the team it saves, but the player is not in the team!
  14. Klesh

    getPlayerTeam

    Hello Community, i've try to do a script, this script it saves the team, when you quit and login, you are in the same team you left when you quit the game, so here is the code: function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local playerteam = getPlayerTeam ( source ) setAccountData ( playeraccount, "xsrpg.team", playerteam ) end end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local playerteam = getAccountData ( playeraccount, "xsrpg.team" ) if ( playerteam ) then setPlayerTeam ( source, playermoney ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHander ( "onPlayerLogin" getRootElement ( ), onPlayerLogin ) The team not saved. Note: The team is created by admin with the panel!
  15. Klesh

    Coded Script!

    -somone, i try it but hexadecimal codes not find it, "string".
  16. Klesh

    Coded Script!

    Hello community i try to show the kill message, but the color look on white i try to make some code and combonations, i mean show the name with the hexadecimal code, and if i can change the font how i can change it, thanks for any help! addEvent("onZombieWasted") addEventHandler( "onZombieWasted", getRootElement(), function (killer) killerName = getPlayerName(killer) weapon = getPedWeapon(killer) wr, wg, wb = getPlayerNametagColor(killer) exports.killmessages:outputMessage ( {killerName,{"padding",width=3},{"icon",id=weapon or 0},{"padding",width=3},{"color",r=240,g=0,b=0},"Zombie"},getRootElement(),wr,wg,wb ) end)
  17. Hi community, i have to try edit castillo's script race userpanel to save race wins and race looses, how can i make it, here is the code from old script (better): function DestructionMoney2() local alivePlayers = getAlivePlayers() if info == "Destruction derby" then if #alivePlayers == 1 then local playername = getPlayerName(alivePlayers[1]) local serial = getPlayerSerial(alivePlayers[1]) local oldData = executeSQLSelect( "RaceStats", "Wins","serial = '" .. serial .. "'") local oldData = executeSQLSelect( "RaceStats", "Wins","serial = '" .. serial .. "'") newData = tonumber(oldData[1]["Wins"]) + 1 setElementData(alivePlayers[1],"Wins",tonumber(getElementData(alivePlayers[1],"Wins"))+1) executeSQLUpdate ( "RaceStats", "Wins = '"..newData.."'","serial = '" .. serial .. "'") end end end addEventHandler ( "onPlayerSpawn", getRootElement(), DestructionMoney2 ) addEventHandler ( "onPlayerLogin", getRootElement(), DestructionMoney2 ) addEventHandler("onPlayerWasted",rootElement, function () setElementData(source,"Deaths",tonumber(getElementData(source,"Deaths"))+1) local serial = getPlayerSerial(source) local oldData = executeSQLSelect( "RaceStats", "Deaths","serial = '" .. serial .. "'") newData = tonumber(oldData[1]["Deaths"]) + 1 executeSQLUpdate ( "RaceStats", "Deaths = '"..newData.."'","serial = '" .. serial .. "'") end) addEventHandler ( "onPlayerSpawn", getRootElement(), source ) addEventHandler ( "onPlayerLogin", getRootElement(), source ) function carColorChanger(carRedBar,carGreenBar,carBlueBar,carBlueBar2) playerVehicle = getPedOccupiedVehicle ( source ) if ( playerVehicle ) then setVehicleColor ( playerVehicle, carRedBar,carGreenBar,carBlueBar,carBlueBar2 ) end end addEvent("changeCarColor", true) addEventHandler("changeCarColor", rootElement,carColorChanger) function carLightsColorChanger(car, r, g, b) if ( car ) then setVehicleHeadLightColor (car, r, g, b) end end addEvent("changeLightsColor", true) addEventHandler("changeLightsColor", rootElement, carLightsColorChanger) I try to edited, but nothing, how i can save the wins! Thanks for any help! Dont worry to try up the wins count, i alredy fixed with the race.zip file.
  18. Klesh

    Help please!

    I try to help no to up my count posts.
  19. You post here for show your script? or becuase you have any problems or errors with the code? If you are posting for show your scriptm this is not the correctly place you must post it on the resources topic or in community, Good luck!
  20. Klesh

    Help please!

    Try the edited code: function setElementSpeed(element, unit, speed) if (unit == nil) then unit = 0 or if (speed == nil) then speed = 0 then speed = tonumber(speed) local acSpeed = setElementSpeed(element, unit) if (acSpeed~=false) then local diff = speed/acSpeed local x,y,z = setElementVelocity(element) setElementVelocity(element,x*diff,y*diff,z*diff) end end end end addCommandHandler("sspeed",getRootElement,(ThisResource()),
  21. Klesh

    Help please!

    You must use [ code=text ] here your script code [ /code ] to post your codes and we can see in what you need help or where is the error. Use [ code=lua ] here your script code[ /code ] to post the format text, you must read the announcements for scripters! Use it with Edit Post, select code.
  22. And trigger the events to do a succesfully logged in. If need some help try to follow this GUI tutorial, see tutorial here!
  23. Klesh

    Admin panel

    Try with this and check it out!
  24. There is a resource with you can get kills and deaths, this resource comes with MTA, you must start with admin panel, the name of the resource is scores, start it and you will see, but dont you think the kills and all that will be saved because you must to create some script for that.
  25. Klesh

    Race mod!

    To delete that colummns you must to go deathmatch/resources/race/race_client then press F3 and search "add" or "score" and you will see something like this: import.dxscoreboard:scoreboardAddColumn("checkpoints") exports.dxscoreboard:scoreboardAddColumn("checkpoints") Try it. And the color code in scoreboard, you must to enable with admin apanel on settings, changing showColorCodes to true then restart the resource and the colors will be show in it.
×
×
  • Create New...