Random spawns for every skin
#1

I'm going to keep this as simple as I can to avoid confusion: How do I make random spawns for seperate skins?

Explanation:

I don't want global random spawns, I want random spawns for skin ID 0, a different set of spawns for cops and different spawns for gang members etc.

I know how to make random spawns with an array, but AFAIK you can only store 2 values per array 'entry', but I need 3 - the first one will be the skin ID, the second will be the spawn ID to be able to have multiple spawns per skin and the third will hold the values such as X, Y, Z, angle.

Any help is much appreciated.

P.S: I have been scripted for 4 years. Problem is I've never made random spawns.

EDIT: Brainwave: Will using enums help?
Reply
#2

pawn Код:
public OnPlayerSpawn(playerid)
{
     new classid = GetPlayerSkin(playerid);
     if(classid == 0)
     {
          switch(random(6))
          {
                 case 0: SetPlayerPos(playerid,x,y,z);
                 case 1: SetPlayerPos(playerid,x,y,z);
                 case 2: SetPlayerPos(playerid,x,y,z);
                 case 3: SetPlayerPos(playerid,x,y,z);
                 case 4: SetPlayerPos(playerid,x,y,z);
                 case 5: SetPlayerPos(playerid,x,y,z);
          }
      }
      else  if(classid == 1)
      {
           switch(random(6))
          {
                 case 0: SetPlayerPos(playerid,x,y,z);
                 case 1: SetPlayerPos(playerid,x,y,z);
                 case 2: SetPlayerPos(playerid,x,y,z);
                 case 3: SetPlayerPos(playerid,x,y,z);
                 case 4: SetPlayerPos(playerid,x,y,z);
                 case 5: SetPlayerPos(playerid,x,y,z);
          }
      }
     return 1;
}
Sorry for identation :S:S
Reply
#3

I don't want to have the code in the middle of my script, I really would like to have it in an array.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)