Jump to content

Extremo

Members
  • Posts

    37
  • Joined

  • Last visited

About Extremo

  • Birthday 02/01/1993

Details

  • Location
    Bremen, Germany
  • Occupation
    Student and sometimes programmer in some companys.
  • Interests
    Programming and everything else of course

Extremo's Achievements

Rat

Rat (9/54)

0

Reputation

  1. Hm, I tested your idea about triggering a server event as well, but it didn't work either. So I am having a guess here that somewhere inside the code there is an error that makes it impossible for the client to load the script at all. I'll have a look at it now and see if I can find any error - if not I'll probably get back to this thread and post some more code. The code is quite big and I don't wanna end up asking you to make it for me. EDIT: You're actually right - the problem lies in the simple fact that the client script is not yet loaded when the server is requesting the particular event. Is there some way to make sure that something is only triggered after all files have been loaded? Right - I just triggered a server event whenever the client resource was started and it now works flawlessly - not a single error. This is resolved =) Regards.
  2. Hey guys, I am literally ripping my hair out here. I've been working on this since the morning and it just keeps on giving me the same error no matter what I try. It's funny because I actually don't see anything wrong at all - so I guess another pair of eyes might be nice. The problem is that I call a client-event from my server but I keep getting the issue back that apparently this "client-event" has not been added by the client. Here's a couple lines: Server: function ShowAccountMenu() setElementFrozen(source, true) if getAccount(getPlayerName(source)) then triggerClientEvent("extremo::login::show", source) else triggerClientEvent("extremo::register::show", source) end end Client: addEvent("extremo::login::show", true, true) addEvent("extremo::register::show", true, true) addEvent("extremo::login::ok", true, true) addEvent("extremo::register::ok", true, true) addEvent("extremo::login::bad",true, true) addEvent("extremo::register::bad",true, true) addEventHandler("extremo::login::show", getRootElement(), function () guiSetVisible(accMenu, true) showCursor(true) guiSetInputEnabled(true) end ) Clearly I have added the event and I've even told the code that it can be remotely called by the server. I tried it with false on the remote part. I tried it without that parameter at all. I tried moving it around. I had an external function at first - so then I put the function into the addEventHandler. I don't know what else to do really, not even the debug shows me any errors. I am lost here.
  3. Hey, The problem is that onResourceStart does not actually have a player-parameter. It has a source parameter which however in your case would be: function showTextDisplay ( player ) -- player == getResourceRootElement(getThisResource()) Which for obvious reasons is not the player. You can figure the rest from there I am sure. Regards.
  4. Extremo

    Hide map

    Weird, for me it still displays it. Are you sure you made it all clientside? function DisableMap() toggleControl("radar", false) end addEventHandler("onClientResourceStart", getRootElement(), DisableMap) Works flawless on clientside. @ Shadow Your script enables it for everybody or disables it for everybody doesn't it? I want to disable it for everybody and renable it for specific players - not everybody. Regards.
  5. Thanks I found the problem. I left out the third arguement on SetTimer assuming that it would automatically be zero, but instead it actually didn't create the timer at all. Silly me. This is now solved. Thanks for all the help =)
  6. You only made some code to make the ped walk forwards and I've already made that - my concern lies within the function to update the rotation for every player which I posted here: Click me EDIT: Nevermind I just saw yours lol. Must of skipped that one somehow. EDIT2: Yeah I already changed the if like you have, so the problem is probably not in there. You also have the SetTimer thing execute the UpdatePeds only 5 times and I've already removed that as well. The "if" looks like this: if not (ped[p]==nil) then So the problem isn't in there. It's rather that for some weird reason, ped[p] is always nil.
  7. Thanks for figuring out that one but it didn't fix the whole thing either way. It still doesn't work so I added a debug to see if it even finds any "ped[p]" that isn't nil and it doesn't. Which leads me to the question that maybe the "ped" array is wrong? EDIT: I forgot to mention tho that I use the "ped" array already before-hand to make the ped walk forwards and that works fine. However inside the loop the ped array doesn't seem to work properly. Can you see any reason why?
  8. Because one gets the position of the player, the other however gets the position of the ped?
  9. Oh, I thought that was the time the function may have to execute. Ah I just read the wiki again and I clearly misread it. I thought it said: "TimeToExecuteFunction" Thanks again! EDIT: It doesn't seem to work even after changing the SetTimer thing.
  10. Right, I sort of fixed the issue. Apparently the issue was using "table.insert" which I used after I saw it being used by one of the above posters. Though now that it does work, another code that was connected to it still doesn't. Could someone have a look at this? I am sorry I don't mean to ask you all to code for me but I am not so familiar with this all. The solution to my first problem was just adding forward btw. The problem however why it didn't work even though I added forward was because the lua script crashed at "table.insert". After I reverted that change for obvious reasons it worked flawlessly. So I don't know if it was just me or table.insert wasn't the best solution at hand. Either way, this is my new problem: Clientside - below the makeWalk part function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end function UpdatePeds() local players = getElementsByType( "player" ) for k, p in ipairs(players) do if not ped[p] == nil then local x,y,z = getElementPosition(p) local px,py,pz = getElementPosition(ped[p]) local a = findRotation(px,py,x,y) setPedRotation(ped[p], a) end end end setTimer(UpdatePeds, 500, 5) It doesn't seem to update the rotation at all. Does anyone have a clue why? Any help is appreciated. Sorry if I am bothering anyone here.
  11. Already did. It does and I also checked if any of them is nil - they aren't. In fact thePlayer is correct. Not sure if thePed arguement is passed on correctly though.
  12. I am afraid but that didn't fix the issue.
  13. Extremo

    Hide map

    I don't think you understood my question precisely. I am trying to toggle the F11 map for everybody though if I give them a map script-wise I want to re-enable the map for them, but only for those who DO have a map.
  14. I think you must use setPedAnimation. Well that would just play the animation but not move the ped.
  15. Hey, Apart from the table.insert I don't see much difference. Also, it actually doesn't save the ped's related to the player but only stores the peds related to peds which is not what I want. I want the ped to store in that array relative to the player's index. I hope you get my point. However since yours isnt really that different how'd yours make a difference? The ped is being created fine however it doesn't start moving.
×
×
  • Create New...