[Solved] More random spawns
#1

Ok, I have a problem making random spawn points on more than 1 DM commands.
I only have random spawns on ONE command. But I want it on more. How to do that?
Reply
#2

Bump. 12+ hours, I'm stuck
Reply
#3

Maybe try using stock instead of public, or just copy the whole function itself to the command, should work.
pawn Код:
if(strcmp(cmdtext, "/ltkdm", true) == 0) { //Don't join with armour because of the bugged headshot script.
new pName[MAX_PLAYER_NAME];
new string[256];
new rand = random(sizeof(gRandomPlayerSpawns));
SetPlayerPos(playerid, gRandomPlayerSpawns[rand][0], gRandomPlayerSpawns[rand][1], gRandomPlayerSpawns[rand][2]);
ShowPlayerMarkers(0);
ResetPlayerWeapons(playerid);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 2);
SetPlayerArmour(playerid, 0.0); //This is needed so players can't join with armour.
SetPlayerHealth(playerid, 5); //This activates the Licence To Kill mode. This means one-hit-kill.
GivePlayerWeapon(playerid, 23, 500); //Silenced pistol.
ResetPlayerMoney(playerid);
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "%s has joined the Licence To Kill deathmatch. Use /ltkdm to join.", pName);
SendClientMessageToAll(0xFFFF00AA, string);
SendClientMessage(playerid, red, "-------------------------------------------------------------------------------------");
SendClientMessage(playerid, green, "Welcome to the Licence To Kill deathmatch. Kill your enemies before they kill you.");
SendClientMessage(playerid, green, "Remember, Licence To Kill means one shot to kill. Your only weapon is the silenced pistol.");
SendClientMessage(playerid, COLOR_GREEN1, "Type /mainworld if you are done with dm'ing. This resets your weapons though.");
SendClientMessage(playerid, red, "-------------------------------------------------------------------------------------");
return 1;
}
Reply
#4

Yes, that works fine, but I already have random spawns at this command.
What I try to say is that I also need random spawns on other dm zones.
For example the LV Fightclub, I only have SetPlayerPos and the coordinates. The ONLY Random spawns that I have is under ltkdm.
It will be bugged if I use the same code for the other dm zones. Do I need an another random spawn code per DM command? Please Help.
Reply
#5

yes, you need.
Reply
#6

Thanks, Blades, I will not use the publics anymore.
Quote:
Originally Posted by AG Adam
Yes, you need.
So I need other codes for random spawns on other DMs.
What codes?
Reply
#7

Okay, if you want it to have other random locations, that are not in your command, you have to make new arrays with the other positions.
pawn Код:
if(strcmp(cmdtext, "/othercommand", true) == 0) {
new rand = random(sizeof(gMoreRandomPlayerSpawns));
SetPlayerPos(playerid, gMoreRandomPlayerSpawns[rand][0], gMoreRandomPlayerSpawns[rand][1], gMoreRandomPlayerSpawns[rand][2]);
return 1;
}
pawn Код:
if(strcmp(cmdtext, "/othercommand2", true) == 0) {
new rand = random(sizeof(gMoreRandomPlayerSpawns2));
SetPlayerPos(playerid, gMoreRandomPlayerSpawns2[rand][0], gMoreRandomPlayerSpawns2[rand][1], gMoreRandomPlayerSpawns2[rand][2]);
return 1;
}
Ect..
Reply
#8

THANKS!!! <3
Reply
#9

heres the code i use for my random spawn DM:
Код:
if(strcmp(cmdtext, "/yourdm", true) == 0)
	{
		ResetPlayerWeapons(playerid);
		new YOURVARDM[128], playerName[MAX_PLAYER_NAME], RandomSpawn = random(8);
		GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
		if (RandomSpawn == 0)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, X,Y,Z);
			SetCameraBehindPlayer(playerid);
		}
		if (RandomSpawn == 1)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, X,Y,Z);
  			SetCameraBehindPlayer(playerid);
		}
		if (RandomSpawn == 2)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, X,Y,Z);
			SetCameraBehindPlayer(playerid);
		}
		if (RandomSpawn == 3)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, X,Y,Z);
			SetCameraBehindPlayer(playerid);
		}
		if (RandomSpawn == 4)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, X,Y,Z);
			SetCameraBehindPlayer(playerid);
		}
		if (RandomSpawn == 5)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, X,Y,Z);
			SetCameraBehindPlayer(playerid);
		}
		if (RandomSpawn == 6)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, X,Y,Z);
			SetCameraBehindPlayer(playerid);
		}
		if (RandomSpawn == 7)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, X,Y,Z);
			SetCameraBehindPlayer(playerid);
		}
		SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 0.0);
		//SetPlayerInterior(playerid, 0);
		SetPlayerVirtualWorld(playerid, 0); //change to another virtual world if you want
        GivePlayerWeapon(playerid, 31, 5000); //do as much as you want and any weapons as you want
		SendClientMessage(playerid, COLOR_BLUE, "You have been teleportated to -YOURDM- to exit type /MainWorld"); //from your script Speed ;)
		SendClientMessage(playerid, COLOR_RED, "SHOOTING WITH WEAPONS OUTSIDE -YOURDM- WIL RESULT IN KICK OR BAN!!!");
		format(YOURVARDM, sizeof(YOURVARDM), "%s has teleported to /YOURDM", playerName);
		new name[MAX_PLAYER_NAME+1];
		new String[256];
		GetPlayerName(playerid, name, sizeof(name));
		format(String, sizeof(String), "%s as join YOURDM type /YOURDM to join", name);
		SendClientMessageToAll(COLOR_DARKGREEN, String); //use the color you want on each COLOR_whatever
		print(String); //comment this line if you dont want to know who went to the dm
		for(new i=0; i<MAX_PLAYERS; i++)
		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)