Jump to content

Recommended Posts

Posted

Hi Guys,

I am currently working on a project (just for fun, nothing to serious) where I want to challenge myself to see how far I can get with RageMP Developement. Therefor I am creating a basic roleplay server to test all the functions of Rage. I chose that I wanted to do that both Server- and Clientside with C#.

spacer.png

^This is the current camera position (Standard Character Cam)

Now I got a basic Login System working but lets be honsest. Having a Login Form over the standard spawning position is quite boring. Therefor I want to create a new static Camera that is sitting in front of Mazebank Tower or some other interesting position on the map. Can anyone point me in the right direction on how to do that with C#? It seems like the documentation on the "Cam" functions of the Client Side with C# is not quite filled in ^^ 

As to what I tried:

- Create a Camera with RAGE.Game.Cam.CreateCam() and setting it Active with RAGE.Game.Cam.SetCamActive()

Problem : RAGE.Game.Cam.CreateCam() seems to always return -1 for me.

- Google Searches

If I find something related to cameras and RageMP it is always NodeJS based

- Searching through NodeJS Github Example Projects and trying to immitate what I see there into C#

 

I am quite frustrated with this topic right now, and I hope that someone maybe can point me in the right direction. (I actually dont want a copy-paste solution, just an explanation of what to do and what I might oversee here.)

Best Regards, 

MikeZeen

Posted (edited)

I recommend u to use Javascript for all Client-side and C# for all Server Side functions and else. Its much better than C# for client side cause it's not fully functional in comparison to JS.

C# is great for all functions thats not for all overlays and else.

 

Best regards

Edited by Zepenthium
Posted
4 hours ago, Zepenthium said:

I recommend u to use Javascript for all Client-side and C# for all Server Side functions and else. Its much better than C# for client side cause it's not fully functional in comparison to JS.

C# is great for all functions thats not for all overlays and else.

 

Best regards

They mostly work the same way, there are few things you can currently do in JS that you can't in C# (mp.storage for example)

Posted (edited)

Hello,

To answer your question, the static camera works for me. What I did:

Create an int variable, to hold the 'temporary camera' id:

int camera = 0;

//Now, when you load CEF:

camera = RAGE.Game.Cam.CreateCameraWithParams(RAGE.Game.Misc.GetHashKey("DEFAULT_SCRIPTED_CAMERA"), PosX, PosY, PosZ, RotationX, RotationY, RotationZ,, 70.0f, true, 2);
RAGE.Game.Cam.SetCamActive(camera, true);
RAGE.Game.Cam.RenderScriptCams(true, false, 0, true, false, 0);

//And when you're done with the login, just use

RAGE.Game.Cam.DestroyCam(camera, true);
RAGE.Game.Cam.RenderScriptCams(false, false, 0, true, false, 0);

//to remove the temporary camera;

You have to replace Position and rotation with your own coordinates; (You have to manually get the coordinates. You can use the /save command from this resource for example

 

Edited by Tonytza
  • Like 1
  • 1 year later...
Posted
On 6/27/2020 at 6:19 AM, Tonytza said:

Hello,

To answer your question, the static camera works for me. What I did:

Create an int variable, to hold the 'temporary camera' id:

int camera = 0;

//Now, when you load CEF:

camera = RAGE.Game.Cam.CreateCameraWithParams(RAGE.Game.Misc.GetHashKey("DEFAULT_SCRIPTED_CAMERA"), PosX, PosY, PosZ, RotationX, RotationY, RotationZ,, 70.0f, true, 2);
RAGE.Game.Cam.SetCamActive(camera, true);
RAGE.Game.Cam.RenderScriptCams(true, false, 0, true, false, 0);

//And when you're done with the login, just use

RAGE.Game.Cam.DestroyCam(camera, true);
RAGE.Game.Cam.RenderScriptCams(false, false, 0, true, false, 0);

//to remove the temporary camera;

You have to replace Position and rotation with your own coordinates; (You have to manually get the coordinates. You can use the /save command from this resource for example

 

What are the 2 last params of the function ? Thanks :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...