Jump to content

tosfera

Members
  • Posts

    1,193
  • Joined

  • Last visited

Everything posted by tosfera

  1. hmmm I see, this did the trick; if ( source == finishTrucker ) and ( hitPlayer == localPlayer ) then Nothing else is changes, as I see. Thanks! Learned something again
  2. Yeah, well. After changing that, it still didn't work.
  3. I don't thing that the functions : setAccountData, getAccountData Are required for this type of code . + He said he wants a marker to be created so he will need these functions : isObjectInACLGroup -- server only function getElementPosition -- server and client function setElementPosition -- server and client function createMarker -- server and client function -------------------- addCommandHandler -- server and client side **NOTE : This code will be server side !! Hmmm you're working with a marker. BUT, just a single question. What is he wants to save it like a checkpoint? even when he logs out? Cause everything I make, will be saved. And if he wants to save them he does need those 2 functions.
  4. I mean you changed the position of it, not the code it self
  5. Well, I can give you the script and you'll be happy and stuff. But you wont learn from it. I'll just give you a few tips. isObjectInACLGroup addCommandHandler setElementPosition setAccountData getAccountData
  6. Seems like an overload crash to me, just make 2 files. and try it then. Dont start them at the same time! Or you can try to do it with a command. (just to see if it gets fixed)
  7. Your problem makes me thing about a endless loop. If you know what I mean! With an endless loop the normal time will be crossed so it will crash. Try loading it in 2 files!
  8. Best thing to do is, go to yourmtaserver.conf file (located in; server/mods/deathmatch/). Scroll down to the bottom of the file and remove the line that says: "votemanager" startup="1" protected="0"/>
  9. Nothing changed hahaha, you just replaced my if, and my last bracket. Its just a coding standart. Thats all. ;o
  10. Let me get the parts that you need; resource start (crap) addEventHandler("onResourceStart", root, function () Trucker = createTeam ( "Trucker", 255, 234, 0 ) end ) ] okee, when he enters the marker, it all starts here: addEventHandler("onMarkerHit", jobMarker_trucker1, function ( source, hitPlayer ) if getElementType( source ) == "player" then local isTeam = getPlayerTeam( source ) if isTeam then local team = getTeamName( getPlayerTeam ( source ) ) if team and team == "Trucker" then local job = getAccountData(getPlayerAccount(source), "player-job") if job == false then triggerClientEvent(source, "startJob_trucker", root) startJob_trucker_marker1() setAccountData(getPlayerAccount(source), "player-job", true) else triggerClientEvent(source, "errorMsg", root, "You are already on a job") end end end end end )
  11. Hey, Okee so I'll ask one more question. And that will be it!! ( I hope), I wrote this script, it will give you a job, a truck + a trailer. it will create a marker and blip CLIENT SIDED. BUT! When I start the job, and a friend of me starts it to, only one of us can finish it. :\ I tought that client was only for 1 player, and not for everyone... So, here's the script: addEvent("startJob_trucker", true) addEventHandler("startJob_trucker", root, function (source) --local places = { {"2754", "-2455", "13"}, {"364", "-2026", "7"} } local places = { {"2405","-2093","13"} } local randJob = math.random(1, 1) finishTrucker = createMarker(places[randJob][1], places[randJob][2], places[randJob][3], "cylinder", 2, 255, 0, 0, 150) blipTrucker = createBlip(places[randJob][1], places[randJob][2], places[randJob][3], 41) outputChatBox(places[randJob][1]) if finish then errorMsg("Deliver this delivery quick!") end end ) addEventHandler("onClientMarkerHit", root, function (hitPlayer) if source == finishTrucker then local v = getPedOccupiedVehicle(hitPlayer) if v then local model = getElementModel(v) local team = getPlayerTeam(hitPlayer) if model == 515 and team then local teamName = getTeamName(team) if teamName == "Trucker" then destroyElement(finishTrucker) destroyElement(blipTrucker) triggerServerEvent("jobFinish_trucker", getLocalPlayer(), hitPlayer, v) end end end end end )
  12. Well not rly, I already got that part. I'm just having a war with the marker and the onClientMarkerHit. It has to finish the job, like; check the team, vehicle, trailer etc etc. but I can do that myself. I guess, I just have no idea why he isn't say: "KOEKJES!" when I hit the marker. :\ has it something to do with the first line? addEventHandler("onClientMarkerHit", , EDIT: Got it working like this; addEventHandler("onClientMarkerHit", root, function (hitPlayer) if source == finishTrucker then outputChatBox("asd") end end ) It was the first line. I placed the marker name, wich is server side... Thanks everyone.
  13. Doesn't work either. n_n"
  14. Hey guys, I keep havling the same issues. Im trying to avoid them but, there has to be a time that I'm going to learn it.... Client scripting. So I started yesterday with client-sided coding, and its not that bad tbh... just one function I really hate... 'onClientMarkerHit'. So, here's the problem: I'm creating a marker in a function. I can NOT avoid this, and I dont want to. But, when I'm making the onClientMarkerHit it doesn't realy work. and I'm thinking its because I created it in another function, but its still the same file. can't be the problem if you ask me. So here's the code I got so far: addEvent("startJob_trucker", true) addEventHandler("startJob_trucker", root, function (source) --local places = { {"2754", "-2455", "13"}, {"364", "-2026", "7"} } local places = { {"2405","-2093","13"} } local randJob = math.random(1, 1) local finishTrucker = createMarker(places[randJob][1], places[randJob][2], places[randJob][3], "cylinder", 2, 255, 0, 0, 150) local blipTrucker = createBlip(places[randJob][1], places[randJob][2], places[randJob][3], 41) outputChatBox(places[randJob][1]) if finish then errorMsg("Deliver this delivery quick!") end end ) addEventHandler("onClientMarkerHit", finishTrucker, function () outputChatBox("KOEKJES") end )
  15. Ugh I hate to ask stupid questions but I hope this will be my last one! I'm getting a bad 'team' pointer on getTeamName. (trying to save the player teams and give them back when I restart my source) for id, player in ipairs(getElementsByType("player")) do local team = getTeamName ( getPlayerTeam ( player ) ) local account = getPlayerAccount(player) local teamEnd = getAccountData(account, "player-team", team) setPlayerTeam(player, getTeamFromName( teamEnd ) ) end
  16. Thanks Castillo, once again. Your script works! And when I'm looking at it, it looks so logic and easy..
  17. hey guys, I'm trying to create a text, for just a short amount of time (5 seconds). So what I'm basicly trying to do right now, is that a user enters a command (/et), the error msg will be drawn for 5 seconds on the client's screen. So far I got this; server: addCommandHandler("et", function ( source ) triggerClientEvent(source, "errorMsg", root, "test") end ) Client: function errorMsg ( errorStr ) addEventHandler("onClientRender", root, drawErrorMsg(errorStr) ) end addEvent( "errorMsg", true ) addEventHandler( "errorMsg", getRootElement(), errorMsg ) function drawErrorMsg (errorStr) dxDrawText ( errorStr, screenWidth - (screenWidth /4), screenHeight - (screenHeight/2), screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1 ) end it seems like the onClientRender doesn't rly work, cause it just creates the error for 1 frame... Thanks in advance! - Tosfera
  18. Tell me, does it have to open with a skin, a team, a player name or with something else? I will write it for you. - Tosfera
×
×
  • Create New...