[HELP] Setting Random Player Spawn Locations
#1

Hello All, i am in need of help URGENTLY

i want to set some player spawm locations that are random (for all players)
however, i have looked in the LVDM script and whenever i add the required lines into my script i get LOADS of errors and warnings when trying to compile.

can somebody please post a tutorial, or a link to one to help me

im sort of a scrpting virgin when it comes to spawns and teleports!!

thanks alot all
Reply
#2

pawn Код:
enum playerspawns {
  spawninterior,
  Float:spawnx,
  Float:spawny,
  Float:spawnz,
  Float:spawna,
}

new RandomPlayerSpawns[][playerspawns] = { //{interior, x, y, z, facing angle},
  {10, 2001.4023,1030.9237,994.4688,180.0}, //replace with your own coordinates
  {3, 359.2969,186.8492,1008.3828,180.0},
  {3, 226.0963,142.6159,1003.0234,0.0}
};
OnPlayerSpawn
Код:
SetPlayerRandomSpawn(playerid);
pawn Код:
SetPlayerRandomSpawn(playerid) {

  new rand = random(sizeof(RandomPlayerSpawns));
  SetPlayerInterior(playerid, RandomPlayerSpawns[rand][spawninterior]);
  SetPlayerPos(playerid, RandomPlayerSpawns[rand][spawnx], RandomPlayerSpawns[rand][spawny], RandomPlayerSpawns[rand][spawnz]);
  SetPlayerFacingAngle(playerid, RandomPlayerSpawns[rand][spawna]);
  return 1;
}
Have fun
Reply
#3

please write a tutorial, the above makes no sense what so ever
Reply
#4

Put the code below somewhere on top of you script
pawn Код:
enum playerspawns {
  spawninterior,
  Float:spawnx,
  Float:spawny,
  Float:spawnz,
  Float:spawna,
}

new RandomPlayerSpawns[][playerspawns] = {
  //{spawninterior, spawnx, spawny, spawnz, spawna}, //interior, x, y, z, angle
  {10, 2001.4023,1030.9237,994.4688,180.0},
  {3, 359.2969,186.8492,1008.3828,180.0},
  {3, 226.0963,142.6159,1003.0234,0.0}
};
Put this code OnPlayerSpawn
Код:
SetPlayerRandomSpawn(playerid);
Put this code whereever you want
pawn Код:
SetPlayerRandomSpawn(playerid) {

  new rand = random(sizeof(RandomPlayerSpawns));
  SetPlayerInterior(playerid, RandomPlayerSpawns[rand][spawninterior]);
  SetPlayerPos(playerid, RandomPlayerSpawns[rand][spawnx], RandomPlayerSpawns[rand][spawny], RandomPlayerSpawns[rand][spawnz]);
  SetPlayerFacingAngle(playerid, RandomPlayerSpawns[rand][spawna]);
  return 1;
}
Have Fun
Reply
#5

C:\Users\Chris\Desktop\Server\gamemodes\untitled.p wn(942) : error 017: undefined symbol "RandomPlayerSpawns"
C:\Users\Chris\Desktop\Server\gamemodes\untitled.p wn(942) : error 029: invalid expression, assumed zero
C:\Users\Chris\Desktop\Server\gamemodes\untitled.p wn(942) : warning 215: expression has no effect
C:\Users\Chris\Desktop\Server\gamemodes\untitled.p wn(943) : error 017: undefined symbol "RandomPlayerSpawns"
C:\Users\Chris\Desktop\Server\gamemodes\untitled.p wn(943) : warning 215: expression has no effect
C:\Users\Chris\Desktop\Server\gamemodes\untitled.p wn(943) : error 001: expected token: ";", but found "]"
C:\Users\Chris\Desktop\Server\gamemodes\untitled.p wn(943) : error 029: invalid expression, assumed zero
C:\Users\Chris\Desktop\Server\gamemodes\untitled.p wn(943) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Errors.

^^^^^^^^^^ right it makes no sense, setting spawns is shit!
Reply
#6

dunno what you did wrong..

Have fun
Reply
#7

Quote:
Originally Posted by Μαστερμινδ
dunno what you did wrong..

Have fun
dont be horrible, thats not helping at all
Reply
#8

Worked for me...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)