SA-MP Forums Archive
singleplayer checkpoints - 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: singleplayer checkpoints (/showthread.php?tid=660524)



singleplayer checkpoints - Mike861 - 05.11.2018

This is the topic that's been bothering me for a long time now. So as you know, the checkpoints from interiors such as Pizza Stack, Burger Shot, Cluckin Bell and Ammu Nation disappear if you have DisableInteriorEnterExits(); in your script. Now i wonder, how come a few servers i play on have that off and yet have singleplayer checkpoints inside those interiors? How the hell is that even possible?


Re: singleplayer checkpoints - v1k1nG - 05.11.2018

Because they know the right model id


Re: singleplayer checkpoints - Mike861 - 05.11.2018

Quote:
Originally Posted by v1k1nG
View Post
Because they know the right model id
What do you mean right model id?


Re: singleplayer checkpoints - Macronix - 05.11.2018

https://sampwiki.blast.hk/wiki/SetPlayerCheckpoint


Re: singleplayer checkpoints - Mike861 - 05.11.2018

Quote:
Originally Posted by Macronix
View Post
What do i do with that? I appreciate your help but i don't see the solution.


Re: singleplayer checkpoints - Macronix - 05.11.2018

Do you mean the yellow marker at the entrances and exits or the red checkpoint where you can buy food, weapons, etc ?

If you mean the yellow marker, that's an object used as a pickup. Should be object ID 19902.

And for the red checkpoint, you just save the position where you want to have the checkpoint inside the interior, fill in the coordinates from your save in SetPlayerCheckpoint, put it where you want to have it, e.g. show it, when a player enters that area/interior, assign a variable to it and check for it under OnPlayerEnterCheckpoint
Same for the red checkpoint actually.


Re: singleplayer checkpoints - Mike861 - 05.11.2018

Quote:
Originally Posted by Macronix
View Post
Do you mean the yellow marker at the entrances and exits or the red checkpoint where you can buy food, weapons, etc ?

If you mean the yellow marker, that's an object used as a pickup. Should be object ID 19902.

And for the red checkpoint, you just save the position where you want to have the checkpoint inside the interior, assign a variable to it and check for it under OnPlayerEnterCheckpoint
I mean the checkpoints where you can buy meals or weapons. They are available only if DisableInteriorEnterExits(); isn't in gamemode. Yet, the server i play on has that off, and has custom enter/exits, still has those checkpoints inside those interiors. I really wonder how, and i can't really make it server side because the menus are limited in SA-MP, ain't like from singleplayer.


Re: singleplayer checkpoints - niCe - 05.11.2018

It is probably scripted, so it looks like it's from singleplayer.


Re: singleplayer checkpoints - Mike861 - 05.11.2018

Quote:
Originally Posted by niCe
View Post
It is probably scripted, so it looks like it's from singleplayer.
Is it possible to use left and right keys to change between meals and have all the sounds and exact same animations like from singleplayer?


Re: singleplayer checkpoints - NaS - 05.11.2018

There are 2 actual checkpoints in SAMP, ignoring race CPs here. The standard checkpoint (SetPlayerCheckpoint) which can be modified in size, it's red and has multiple layers.
Then there are also the mission Checkpoints which can be spawned by creating a MapIcon with mode MAP_ICON_LOCAL_CHECKPOINT or MAP_ICON_GLOBAL_CHECKPOINT.

Iirc the Ammu Nations and Restaurants use the standard red checkpoint, which can be achieved with SetPlayerCheckpoint.

Like niCe and Macronix said, it's scripted, they use SetPlayerCheckpoint to create a checkpoint at that location.
Furthermore the Menus from SP can indeed be recreated. You just need to know how to add multiple columns and use DisableMenuRow for the grey texts (prices, etc).

Quote:
Originally Posted by Mike861
View Post
Is it possible to use left and right keys to change between meals and have all the sounds and exact same animations like from singleplayer?
Yes, you need to find out the animations and use an actor as ped. Rest can be scripted with ApplyActorAnimation, GetPlayerKeys and SetPlayerCameraPos/LookAt.
If you also want the actual meal to be carried by the Ped, you'll need to use an NPC with SetPlayerAttachedObject.


Re: singleplayer checkpoints - Mike861 - 05.11.2018

Quote:
Originally Posted by NaS
View Post
There are 2 actual checkpoints in SAMP, ignoring race CPs here. The standard checkpoint (SetPlayerCheckpoint) which can be modified in size, it's red and has multiple layers.
Then there are also the mission Checkpoints which can be spawned by creating a MapIcon with mode MAP_ICON_LOCAL_CHECKPOINT or MAP_ICON_GLOBAL_CHECKPOINT.

Iirc the Ammu Nations and Restaurants use the standard red checkpoint, which can be achieved with SetPlayerCheckpoint.

Like niCe and Macronix said, it's scripted, they use SetPlayerCheckpoint to create a checkpoint at that location.
Furthermore the Menus from SP can indeed be recreated. You just need to know how to add multiple columns and use DisableMenuRow for the grey texts (prices, etc).



Yes, you need to find out the animations and use an actor as ped. Rest can be scripted with ApplyActorAnimation, GetPlayerKeys and SetPlayerCameraPos/LookAt.
If you also want the actual meal to be carried by the Ped, you'll need to use an NPC with SetPlayerAttachedObject.
Damn, then that's really alot of work. I also need to learn the menus properly, i just started using them before i never really did in the past. May i atleast know how to reset the player camera and hide the menu upon pressing enter?


Re: singleplayer checkpoints - NaS - 05.11.2018

Quote:
Originally Posted by Mike861
View Post
Damn, then that's really alot of work. I also need to learn the menus properly, i just started using them before i never really did in the past. May i atleast know how to reset the player camera and hide the menu upon pressing enter?
To reset the camera after using SetPlayerCameraPos you can use SetCameraBehindPlayer.

When pressing F the menu will be automatically hidden and OnPlayerExitedMenu will be called:

https://sampwiki.blast.hk/wiki/OnPlayerExitedMenu

So you only need to reset the camera there and unfreeze the player, since the menu hides on its own.


Re: singleplayer checkpoints - Mike861 - 05.11.2018

Quote:
Originally Posted by NaS
View Post
To reset the camera after using SetPlayerCameraPos you can use SetCameraBehindPlayer.

When pressing F the menu will be automatically hidden and OnPlayerExitedMenu will be called:

https://sampwiki.blast.hk/wiki/OnPlayerExitedMenu

So you only need to reset the camera there and unfreeze the player, since the menu hides on its own.
Thanks man, much aprreciate it. +rep