SA-MP Forums Archive
Custom player spawning - 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: Custom player spawning (/showthread.php?tid=449520)



Custom player spawning - Micius - 09.07.2013

How to make custom player spawning:
When you connect to server, you will appear in train, who is driving to somewhere, and when he reaches station, player will spawn there. Player see train from custom cam point.


Re: Custom player spawning - Yordan_Kronos - 09.07.2013

pawn Код:
public OnPlayerSpawn(playerid)
{
     new randomspawn = random( number of your spawns );
     switch ( randomspawn )
     {
          case 1 : SetPlayerPos( playerid , x , y , z ) ; // Random Spawn 1
          case 2 : SetPlayerPos( playerid , x , y , z ) ; // Random Spawn 2
          // add more if you want
     }
     return 1;
}
or just follow the samp wiki one

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


Re: Custom player spawning - Micius - 09.07.2013

Quote:
Originally Posted by Yordan_Kronos
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn(playerid)
{
     new randomspawn = random( number of your spawns );
     switch ( randomspawn )
     {
          case 1 : SetPlayerPos( playerid , x , y , z ) ; // Random Spawn 1
          case 2 : SetPlayerPos( playerid , x , y , z ) ; // Random Spawn 2
          // add more if you want
     }
     return 1;
}
or just follow the samp wiki one

https://sampwiki.blast.hk/wiki/Random
Did you even read what i wrote?


Re: Custom player spawning - Cjgogo - 09.07.2013

Quote:
Originally Posted by Micius
Посмотреть сообщение
Did you even read what i wrote?
Maybe he didn't. HOWEVER, I won't be giving you the code, because it's just long I guess, I mean it's not hard, but it needs a little bit of work put into it. FIRST, you need an NPC driving a train(you record the route, you stop at whatever station/point you wish). You need a function to get the train's speed, because if a player connects, and immediatly 1 min or so later another one does, he won't have to wait for the train, but he will get teleported inside it, and stop at the station togheter with the other player. About the camera, you may attach it to the vehicle at a point above the train and change its angle, that is absolutely up to your wish. SO, yeah, that's all. When you get at the station, check the train's speed, and if it's ), just eject the player. USEFUL link:

https://sampwiki.blast.hk/wiki/Category:NPC


Re: Custom player spawning - Micius - 09.07.2013

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
Maybe he didn't. HOWEVER, I won't be giving you the code, because it's just long I gues, I mean it's not hard, but it needs a little bit of work put into it. FIRST, you need an NPC driving a train(you record the route, you stop at whatever station/point you wish). You need a function to get the train's speed, because if a player connects, and immediatly 1 min or so later another one does, he won't have to wait for the train, but he will get teleported inside it, and stop at the station togheter with the other player. About the camera, you may attach it to the vehicle at a point above the train and change its angle, that is absolutely up to your wish. SO, yeah, that's all. When you get at the station, check the train's speed, and if it's ), just eject the player. USEFUL link:

https://sampwiki.blast.hk/wiki/Category:NPC
Can you send me example, im not newbie at scripting, so i will know how to do that.
Im new in creating npcs, and controlling them.


Re: Custom player spawning - Cjgogo - 09.07.2013

Yes, here you go, for the train. Also, use PutPlayerInVehicle, after the player logs in, and RemovePlayerFromVehicle, when he stops at the station. SO, yeah, the train:

https://sampforum.blast.hk/showthread.php?tid=95034
https://sampforum.blast.hk/showthread.php?tid=170545


Re: Custom player spawning - Micius - 09.07.2013

Thanks! +rep