Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. do this, server side: function markerHit( hitPlayer, matchingDimension ) if (source == marker1) then outputChatBox ( "" .. text1a .. "", hitPlayer, 0, 255, 0 ) outputChatBox ( "" .. text1b .. "", hitPlayer, 0, 255, 0 ) outputChatBox ( "" .. text1c .. "", hitPlayer, 255, 0, 0 ) elseif (source == marker2) then outputChatBox ( "" .. text2a .. "", hitPlayer, 0, 255, 0 ) outputChatBox ( "" .. text2b .. "", hitPlayer, 0, 255, 0 ) elseif (source == marker3) then outputChatBox ( "" .. text3a .. "", hitPlayer, 0, 255, 0 ) triggerClientEvent(hitPlayer,"playTheSound",getRootElement()) end end addEventHandler ( "onMarkerHit", getRootElement(), markerHit ) client side: function playIT() local sound = playSound("distress.wav",false) end addEvent( "playTheSound", true ) addEventHandler( "playTheSound", getRootElement(),playIT ) meta.xml <meta> <info name="" author="Blackvein" type="script" version="1.0"/> <script src="scriptclient.lua" type="client" /> <script src="script.lua" type="server" /> <file src="distress.wav" /> </meta>
  2. Castillo

    char ids

    Where do i have to use "xmlNodeGetChildren"?
  3. Castillo

    char ids

    now i get a different error in that line, "bad argument #1 to "pairs" (table exptected, got userdata)"
  4. its because playSound its a client side function, maybe u can trigger a event to client and then play it.
  5. Castillo

    char ids

    hey again, i started to build it with xml but i have a problem when loading the characters, i will post the code and the error i get (im noob at xml btw, just started to learn )
  6. You can re-translate it, dont you?
  7. I ve done this, function move(playerSource) local x,y,z = getElementPosition(playerSource) local xx,yy,zz = getElementRotation (playerSource) setElementRotation(ob,xx,yy,zz+85) setElementPosition (ob,x,y,z) end function timer(playerSource) setTimer(move, 50, 0, playerSource) end addCommandHandler ("m", timer) only problem its that timer isnt that fast like onClientRender
  8. this is what i got, server side: function move(playerSource) local xx,yy,zz = getElementRotation (playerSource) setElementRotation(ob,xx,yy,zz+85) end function trigger(playerSource,ob) triggerClientEvent(playerSource,"move",getRootElement(),ob) setTimer(move, 50, 0, playerSource) end addCommandHandler ("m", trigger) client side: local g_Root = getRootElement() local g_ResRoot = getResourceRootElement(getThisResource()) local g_Me = getLocalPlayer() addEvent("move", true) function startMove() addEventHandler("onClientRender", g_Root, onRender) end addEventHandler("move", g_ResRoot, startMove) function onRender(ob) local x,y,z getElementPosition(g_Me) setElementPosition(ob, x,y,z) end warning: bad argument setElementPosition.
  9. I need to create the object server side cause i want all to see it, then move it with onClientRender.
  10. hey there, i got a problem, i want to create a object, all worked fine in client side but nobody see the object but me so i made it server side and here is the problem, i used onClientRender and getElementPosition getElementRotation to set his pos and rot like mine, the problem is that i dont know how to trigger from server to client to use onClientRender. i also tried using setTimer but all fucks up and dosnt work like i want.
  11. Castillo

    char ids

    this dont actually works, but nevermind i started to make it using xml , if i need help with it i will re-post.
  12. Thats because editor_dump is not a resource, is a part from map editor.
  13. Castillo

    char ids

    SQL its hard for me, also XML, trying to make it via XML but dont get anything of how works.
  14. Castillo

    char ids

    hey there, im scripting a character system and im actually using account data functions for it, the problem is that when i make 1 character it sets the data already but when i want to make 2 characters the problem is that the data already exist so i would like to know how i can make somthing like a id for every character i create, here is code of creation.
  15. Thats exactly what i mean, i dont care that he copied cause this is about help others.
  16. You actually copied my script from another thread and dint even know how to make it?
  17. ahhhhhhhh i found it, thanks!
  18. yea it worked, thanks!
  19. I have already this.
  20. I ever use DEBUG, the error is this now "attempt to perform arithmetic on field "deaths" (a nil value)" in this line: outputDebugString("there was one row with deaths "..row['deaths'].." now its "..row['deaths']+1)
  21. I got everytime i script the debugscript on and no errors comes.
  22. hey guys, i got a problem with a sqlite script, local playerstbl = "deaths" local playerstbl2 = "kills" function start () executeSQLCreateTable("playerstbl", "accountname TEXT, deaths INT") executeSQLCreateTable("playerstbl2", "accountname TEXT, kills INT") outputDebugString ( "Resource loaded.", 3 ) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), start) function login1(prev, account, autologin) local result = executeSQLSelect("playerstbl", "deaths", "accountname = '"..getAccountName(account).."'") local result2 = executeSQLSelect("playerstbl2", "kills", "accountname = '"..getAccountName(account).."'") if result and #result > 0 then setElementData(source, "deaths", tonumber(result[1]["deaths"]) or 0) -- setElementData(source, "kills", tonumber(result2[1]["kills"]) or 0) else executeSQLInsert("playerstbl", "'0', '"..getAccountName(account).."'", "deaths, accountname") executeSQLInsert("playerstbl2", "'0', '"..getAccountName(account).."'", "kills, accountname") end end addEventHandler("onPlayerLogin", getRootElement(), login1) function rewardOnWasted ( ammo, killer, killerweapon, bodypart ) local acc = getPlayerAccount(source) if not isGuestAccount(acc) then local deaths = executeSQLQuery("SELECT deaths FROM playerstbl WHERE accountname = '"..getAccountName(acc).."'")["deaths"] if not deaths then deaths = 1 else deaths = deaths +1 end executeSQLUpdate("playerstbl", "deaths = '"..deaths.."'", "accountname = '"..getAccountName(acc).."'") end end addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted ) function rewardOnWasted2 ( ammo, killer, killerweapon, bodypart ) if (killer ) and (killer ~=source ) then local acc2 = getPlayerAccount(killer) if not isGuestAccount(acc2) then local kills = executeSQLQuery("SELECT kills FROM playerstbl2 WHERE accountname = '"..getAccountName(acc2).."'")["kills"] if not kills then kills = 1 else kills = kills + 1 end executeSQLUpdate("playerstbl2", "kills = '"..kills.."'", "accountname = '"..getAccountName(acc2).."'") end end end addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted2 ) the problem is that when i suicide the "deaths" dosnt set to +1 it just set to 1.
  23. If i put like this function drawList() for num,this_player in ipairs(players) do local plname = getPlayerName(this_player) local r, g, b = getPlayerNametagColor( this_player ) dxDrawText(plname,300,150+num*16,tocolor( r or 255, g or 255, b or 255, 255 ),1.0,"default","left","top",false,false,false) end end text dosnt even appear
  24. ok i have a question, if u dont share it why u say u made it?. in my opinion is kinda useless He explained roughly how he did it tho. In my opinion that's usefull Yes but the guy who asked for it i think dosnt know anything about scripts.
×
×
  • Create New...