Help with randomspawns in a dm area after using the dm command
#1

Hello again. Can someone help me with a random spawn INSIDE a dm area after they used a command.

I only have ONE pos players teleports but that's NOT what I want.
So like this I don't: for example the LV fightclub arena with only ONE pos >.<

pawn Код:
if(strcmp(cmdtext, "/fightclub", true) == 0) {
new pName[MAX_PLAYER_NAME];
new string[256];
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 24, 100);
GivePlayerWeapon(playerid, 32, 5000);
GivePlayerWeapon(playerid, 26, 5000);
GivePlayerWeapon(playerid, 31, 5000);
SetPlayerVirtualWorld(playerid, 1); //Players will teleport to this world to prevent abuse of the command.
SetPlayerArmour(playerid, 100);
ResetPlayerMoney(playerid);
SetPlayerPos(playerid, 2102.84, 2186.23, 14.50);
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "%s has joined LV FightClub. Use /fightclub to join it", pName);
SendClientMessageToAll(0xFFFF00AA, string);
return 1;
}
^This? NO., So can you help me making those pos's random?

Thanks.
Reply
#2

pawn Код:
switch(random(6))
{
  case 0: /*spawn pos*/
  case 1:/*and another*/
  case 2:/*etc*/
  case 3:
  case 4:
  case 5:
}
Reply
#3

DAMN IT 7 ERRORS And like thousand warnings on this code:
pawn Код:
if(strcmp(cmdtext, "/fightclub", true) == 0) {
new pName[MAX_PLAYER_NAME];
new string[256];
switch (Random(6))
{
case 0: 2102.84, 2186.23, 14.50);
case 1: 2071.39, 2164.85, 10.82);
case 2: 2087.48, 2179.62, 10.82);
case 3: 2084.81, 2159.38, 10.82);
case 4: 2100.91, 2170.45, 10.82);
case 5: 2089.34, 2169.85, 10.82);
}
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 24, 100);
GivePlayerWeapon(playerid, 32, 5000);
GivePlayerWeapon(playerid, 26, 5000);
GivePlayerWeapon(playerid, 31, 5000);
SetPlayerVirtualWorld(playerid, 1); //Players will teleport to this world to prevent abuse of the command.
SetPlayerArmour(playerid, 100);
ResetPlayerMoney(playerid);
// just...
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "%s has joined LV FightClub. Use /fightclub to join it", pName);
SendClientMessageToAll(0xFFFF00AA, string);
return 1;
}
Код:
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(209) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(210) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(221) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(222) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(233) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(234) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(292) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(293) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(294) : error 017: undefined symbol "Random"
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(296) : warning 215: expression has no effect
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(296) : warning 215: expression has no effect
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(296) : warning 215: expression has no effect
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(296) : error 001: expected token: ";", but found ")"
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(296) : error 036: empty statement
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(297) : error 014: invalid statement; not in switch
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(297) : warning 215: expression has no effect
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(297) : error 001: expected token: ";", but found ":"
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(297) : error 029: invalid expression, assumed zero
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\mycolor.pwn(297) : fatal error 107: too many error messages on one line

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

Fucking errors I searched for another same case 0: x, y,z
Less errors but still errors.
Someone said that I don;t need to use case 0 1 2 3 etc.
Can somebody help? I don;t understand :/
Reply
#5

at the top of your script put this..
Quote:

new Float:islanddmspawns[16][3] = {
{-696.7625,3204.0144,4.9366}, //
{-689.1344,3143.2222,7.9124}, //
{-678.8207,3080.6030,7.1543}, //
{-584.0181,3169.3674,12.3154}, //
{-566.2000,3195.5068,4.9366}, //
{-787.4612,3209.4063,12.3904}, //
{-787.5907,3209.1912,20.7903}, //
{-854.7209,3171.4958,4.9366}, //
{-816.1633,3366.1816,5.0116}, //
{-785.6259,3428.3169,6.4401}, //
{-693.5211,3396.4290,9.0503}, //
{-693.8293,3365.3694,12.4654}, //
{-693.9604,3365.2095,20.8653}, //
{-661.2188,3329.9993,4.2272}, //
{-564.4163,3390.7454,12.4154}, //
{-527.9631,3421.4661,4.9366} //
};

but change the coords to the positions you have for your dm zones.
then...
put this in onplayercommandtext
Quote:

if(strcmp(cmdtext, "/islanddm", true)==0)
{
SetPlayerInterior(playerid, 0);
new rand = random(sizeof(islanddmspawns));
SetPlayerPos(playerid, islanddmspawns[rand][0], islanddmspawns[rand][1], islanddmspawns[rand][2]);
SetPlayerFacingAngle(playerid, 0.0);
GivePlayerWeapon(playerid,46,1);
SendClientMessage(playerid, COLOR_BLUE, "DEATHMATCH ISLAND");
GivePlayerWeapon(playerid,24,1000);
GivePlayerWeapon(playerid,27,1000);
GivePlayerWeapon(playerid,30,1000);
GivePlayerWeapon(playerid,34,1000);
GivePlayerWeapon(playerid,35,1000);
SetPlayerArmour(playerid,100);
SendClientMessage(playerid,0x33AA33AA,"You can leave the dm by typing /exitdm");
DMZone[playerid] = 1;
return 1;

make sure you rename the islanddmspawns to something that will remind you of the dm zone.
also make sure that with the "new Float:islanddmspawns[16][3] = {," that the count "[16]" shows the ammount of coord lines you have. If not it will make your script not compile.
that should set it so when you join the dm, you spawn at random positions..
lol, i just cant get the respawning right when you die in a dm, to rejoin lol.

good luck
Reply
#6

Thanks, didn;t try it out yet as I look at the code. Where is the message that says to the whole chat that someone is in a dm zone??
Reply
#7

I tested it in a new script, copying your code but it gives me errors mate, I need a professional.
And your code did not include the string to show which player are gone to that dm. I really need.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)