Jump to content
Sign in to follow this  
Capital

[PAWN] RandomSpawn

Recommended Posts

 

RandomSpawn Tutorial.

Salutare, acest RandomSpawn il puteti folosi pentru sistemul de Paintball, sistem de event, etc.. acolo unde vreti ca payerii sa se spawneze in locatii diferite.

 

  • In primul rand, avem nevoie de coordinatele unde vrei ca playerii sa se spawneze. Acest lucru il facem intrand pe server si folosind comanda [/save].
  • Avand coordinatele, mergem in Documents, GTA SAN ANDREAS si la savedposition.txt avem coordinatele salvate pe server.
AddPlayerClass(skinid, x, y, z, angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)

Mai multe detalii aici despre aceasta functie: https://wiki.sa-mp.com/wiki/AddPlayerClass

 

Adaugam la inceputului GameMode-ului:

new Float:RandomSpawns[5][] = 
{
   	{1212.3214,-2034.9223,59.9254,90.2055}, // 1
    {1212.3214,-2034.9223,59.9254,90.2055}, // 2
    {1212.3214,-2034.9223,59.9254,90.2055}, // 3
	{1212.3214,-2034.9223,59.9254,90.2055}, // 4
	{1212.3214,-2034.9223,59.9254,90.2055}, // 5
};
{1238.0105,-2052.6873,59.9975,2.8144}
{x, y, z, angle}
1238.0105 = x
-2052.6873 = y
59.9975 = z
2.8144 = angle
  • Acum mergem la `public OnPlayerSpawn(played)` si adaugam:
    new Random = random(sizeof(RandomPlayerSpawns));
    SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2], RandomSpawns[Random][3], RandomSpawns[Random][4]);
    SetPlayerFacingAngle(playerid, RandomSpawns[Random][5]);
    return 1;

Si daca nu ati folosit `angle`, stergeti

SetPlayerFacingAngle(playerid, RandomSpawns[Random][5]);

 

Edited by Capital

Share this post


Link to post
Share on other sites

Good , m-ai ales pentru incepatori. Usor si folositor.

Share this post


Link to post
Share on other sites

Topic Closed.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.