SA-MP Forums Archive
SetPlayerInterior,CameraPos,LookAt,FacingAngle HELP - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SetPlayerInterior,CameraPos,LookAt,FacingAngle HELP (/showthread.php?tid=547068)



SetPlayerInterior,CameraPos,LookAt,FacingAngle HELP - cleanboy - 20.11.2014

Hi there! Anyone here have a better view when player will spawn in game? idontknow really what is that called.. but this will show you all..

this things are from stevo127's sfcnrrpg

Код:
SetPlayerInterior(playerid,0);
	  SetPlayerPos(playerid,-1753.6743,885.2703,295.8750);
          SetPlayerCameraPos(playerid,-1753.6849,892.0016,295.8750);
	  SetPlayerCameraLookAt(playerid,-1753.6743,885.2703,295.8750);
	  SetPlayerFacingAngle(playerid,0.6323);
i dont like this view its kinda irritate my eyes coz of the light on the top of the building.. anyone here have better??


Re: SetPlayerInterior,CameraPos,LookAt,FacingAngle HELP - Schneider - 20.11.2014

I've made a little command for you that you can add to your script that you can use to easily save player- and camera-positions.

How to use it:
- Go to any location you like,
- Position your player and the camera how you want it to show up in Class Selection
- Type /saveloc [+optional description]
- Open server_log.txt
- At the bottom you'll find the coordinates of your player and camera as well as interior ID
- Copy and paste those values to the according functions in your OnPlayerRequestClass-callback
- Recompile the script and restart the server.
- Enjoy your new Class-selection location!

I assume you are using zcmd, if not, let me know.

pawn Код:
COMMAND:saveloc(playerid, params[])

    new Float:loc[7], pint, description[64];
    sscanf(params, "s", description);
    GetPlayerPos(playerid, loc[0], loc[1], loc[2]);
    GetPlayerFacingAngle(playerid, loc[3]);
    pint = GetPlayerInterior(playerid);
    GetPlayerCameraPos(playerid, loc[4], loc[5], loc[6]);
    print("/*---------Saved Location: ---------*/");
    printf("Description: %s", description);
    printf("Interior: %d", pint);
    printf("Player X, Y, Z: %.4f, %.4f, %.4f", loc[0], loc[1], loc[2]);
    printf("Player angle: %.2f", loc[3]);
    printf("Camera X, Y, Z: %.4f, %.4f, %.4f", loc[4], loc[5], loc[6]);
    printf("Camera Lookat: %.4f, %.4f, %.4f", loc[0], loc[1], (loc[2]+0.5));
    print("/*-----------------------------------*/");
    SendClientMessage(playerid, 0x33AA33AA, "Location saved succesfully in the server log");
    return 1;
}
Example:



Re: SetPlayerInterior,CameraPos,LookAt,FacingAngle HELP - Abagail - 20.11.2014

You use #pragma unused params yet use it with sscanf. Do you know what #pragma unused does?


Re: SetPlayerInterior,CameraPos,LookAt,FacingAngle HELP - Schneider - 21.11.2014

Quote:
Originally Posted by Abagail
Посмотреть сообщение
You use #pragma unused params yet use it with sscanf. Do you know what #pragma unused does?
You're right, not necessary with zcmd.