Sign in to follow this  

Timer on C# client-side not working

Recommended Posts

Posted (edited)

I'm using C# task to handle event after player spawn, but just look like only the message function work perfectly with the task and others don't.
Here my code:

private void OnPlayerSpawn(Events.CancelEventArgs cancel)

  MainCam = RAGE.Game.Cam.CreateCameraWithParams(RAGE.Game.Misc.GetHashKey("DEFAULT_SCRIPTED_CAMERA"), 350.9601f, -638.4666f, 36.8042f, 0, 0, 0, 90.0f, true, 2);
  RAGE.Game.Cam.SetCamActive(Global.Camera.Main, true);
  RAGE.Game.Cam.PointCamAtCoord(Main, 0.02908f, 0.99953f, 0.00921f);
  RAGE.Game.Cam.RenderScriptCams(true, false, 0, true, false, 0);

  Run(() =>
        RAGE.Game.Cam.DestroyCam(MainCam, true);
        RAGE.Game.Cam.RenderScriptCams(false, false, 0, true, false, 0);
      }, 2000);

public static void Run(Action task, long delayTime = 0)
  Task.Factory.StartNew(async () =>
                          await Task.Delay((int)delayTime);


Edited by BenX

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.