Spawn players + vehicles
#1

Hello

I'm trying to make a script which spawns a player and a vehicle (the player must spawn into the vehicle), and this must work with more than 1 player. Resuming: When the gamemode starts all players that are connected into the server, must spawn into a vehicle in the same place (coordinates), but of course with some space between the other players. Also, when u made this, I'll be happy if you will add an explanation about the script, since I'm a new pawn scripter and I'm learning.

Thanks to those who will help me!
Reply
#2

Search on ****** putplayerinvehicle
Reply
#3

I don't have the time to do it, but I can explain you how to do it and you can give a try!

In OnPlayerSpawn callback, you need to create a vehicle (CreateVehicle), you will also need to get player's coordinates. (GetPlayerPos; GetPlayerFacingAngle). Last, put the player in the vehicle, remember to store the ID and put him in the vehicle (PutPlayerInVehicle). And set the position (SetVehiclePos; SetVehicleZAngle).
Reply
#4

Heres a real quick one with an cmd
pawn Код:
new car; //on top of scipt

if(strcmp(cmdtext, "/car", true,4) == 0)
    {
    new Float:X,Float:Y,Float:Z,Float:A;
    GetPlayerPos(playerid,X,Y,Z);
    GetPlayerFacingAngle(playerid,A);
    Car = CreateVehicle(411,X,Y,Z,A,1,1);
    PutPlayerInVehicle(playerid,Car,0);
 
    return 1;
    }
Reply
#5

Thanks you both guys, but I think I've explained this bad.
What I'm looking for is that, after the class selection, all the connected players into my server, must spawn into a vehicle in a limited area (for example Ganton), without overlap eachother, but with some space between each player
Reply
#6

Quote:
Originally Posted by SantoN
Посмотреть сообщение
Thanks you both guys, but I think I've explained this bad.
What I'm looking for is that, after the class selection, all the connected players into my server, must spawn into a vehicle in a limited area (for example Ganton), without overlap eachother, but with some space between each player
The first thing you should do is find out how to spawn players randomly (for example, have 20 or more spawn points, and have the script randomly choose which spawnpoint to use when spawning a player into the server). Then spawn a vehicle onto the player, then put the player in the vehicle. HERE is one way to do it. Now all you have to do is use Avengers's script to put each spawned player in a car. I hope this helped!
Reply
#7

Quote:
Originally Posted by Aerotactics
Посмотреть сообщение
The first thing you should do is find out how to spawn players randomly (for example, have 20 or more spawn points, and have the script randomly choose which spawnpoint to use when spawning a player into the server). Then spawn a vehicle onto the player, then put the player in the vehicle. HERE is one way to do it. Now all you have to do is use Avengers's script to put each spawned player in a car. I hope this helped!
I think there's another way to do this, cuz if I make 20 random spawn for example, and my server has 21 players, what will happen to the last player? He will spawn in an already occupied spawn point..
Reply
#8

Quote:
Originally Posted by SantoN
Посмотреть сообщение
I think there's another way to do this, cuz if I make 20 random spawn for example, and my server has 21 players, what will happen to the last player? He will spawn in an already occupied spawn point..
As I said "20 or more", this is what I meant, else if it is a 'small' server, you probably won't need more than 30. If it grows bigger and/or too many people are AFK, add some more spawn points
Reply
#9

Ok, so I will use this method. Thanks u guys (gave u reputation)
I got another question; how can I make a system which saves the users password, and when they are connecting again to the server they wouldn't insert the password in a dialog but they will be automatically logged in?
Reply
#10

You can use:
GetPlayerIp(playerid, name, len[]);

Save the IP address in the user file when they register
And when they are coming back, check if the IP address is the same.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)