random spawns on command!
#1

im having trouble with this and i dont know what to do to... i searched everywhere already.
i want so when a player types /dm 1 he will be teleported to his (sniper) dm area and /dm 2 will teleport you to (minigun) dm area.
i got no errors but sometimes i end up with minigun in the other dm zone or sometimes I teleport to air above caligulas. hope you understand
i dont really know how to ues ispawnset can someone explain it to me please?

Код:
new iSpawnSet[MAX_PLAYERS];
new Float:sniperPlayerSpawns[7][4] ={
{185.7247,1456.4003,60.1355,296.3391},
{199.7349,1404.5530,60.1355,160.5870},
{190.8746,1371.7091,46.4297,329.8795},
{218.5236,1467.8160,46.4297,168.4093},
{2218.3030,1614.8231,999.9827,359.3660},
{2171.3486,1623.3280,999.9749,233.3816},
{221.3145,1390.3622,41.7687,282.4753}
};
new Float:minigunPlayerSpawns[5][4] ={
{2220.2681,1556.0397,1004.7231,1.6454},
{2181.6882,1579.2592,999.9714,1.8334},
{190.8746,1371.7091,46.4297,329.8795},
{218.5236,1467.8160,46.4297,168.4093},
{2228.5825,1592.7041,999.9614,85.2363}
};
forward SetPlayerRandomSpawn(playerid);
setplayerrandomspawn...

Код:
public SetPlayerRandomSpawn(playerid)
{
	if(iSpawnSet[playerid] == 0)
	{
		new rand = random(sizeof(sniperPlayerSpawns));
		SetPlayerPos(playerid, sniperPlayerSpawns[rand][0], sniperPlayerSpawns[rand][1], sniperPlayerSpawns[rand][2]);
		SetPlayerFacingAngle(playerid, sniperPlayerSpawns[rand][2]);
	}
	else if(iSpawnSet[playerid] == 1)
	{
		new rand = random(sizeof(minigunPlayerSpawns));
		SetPlayerPos(playerid, minigunPlayerSpawns[rand][0], minigunPlayerSpawns[rand][1], minigunPlayerSpawns[rand][2]);
		SetPlayerFacingAngle(playerid, minigunPlayerSpawns[rand][2]);
	}
	return 1;
}
onplayercommandtext

Код:
 

	if(!strcmp(cmdtext, "/dm 1", true) || !strcmp(cmdtext,"/dmzone 1",true) || !strcmp(cmdtext,"/dm1",true))
	{
	  ResetPlayerWeapons(playerid);
		SetPlayerInterior(playerid, 0);
		SetPlayerRandomSpawn(playerid);
		GameTextForPlayer(playerid, "~r~dmzone 1",2000,3);
 		GivePlayerWeapon(playerid, 34, 500);
		SendClientMessage(playerid, 0xFF641AFF, "Welcome to dmzone 1 !!");
 		GetPlayerName(playerid,name,18);
		SetPlayerArmour(playerid, 0);
 		format(string, sizeof(string), "%s (%i) has been teleported to /dmzone",name,playerid);
 		SendClientMessageToAll(0x80FF00FF,string);
 		printf(string);
		return 1;
	}
	if(!strcmp(cmdtext, "/dm 2", true) || !strcmp(cmdtext,"/dmzone 2",true) || !strcmp(cmdtext,"/dm2",true) || !strcmp(cmdtext,"/dmzone2",true))
	{
	  ResetPlayerWeapons(playerid);
	  SetPlayerInterior(playerid, 1);
	  SetPlayerArmour(playerid, 100);
	  SetPlayerHealth(playerid, 100);
		SetPlayerRandomSpawn(playerid);
		GameTextForPlayer(playerid, "~r~dmzone 2",2000,3);
 		GivePlayerWeapon(playerid, 38, 5000);
		SendClientMessage(playerid, 0xFF641AFF, "Welcome to dm zone 2 !!");
 		GetPlayerName(playerid,name,18);
 		format(string, sizeof(string), "%s (%i) has been teleported to /dmzone 2",name,playerid);
 		SendClientMessageToAll(0x80FF00FF,string);
 		printf(string);
		return 1;
	}
Reply
#2

I think maybe when you say "/dm 1" and "/dm 2" in OnPlayerCommandText you are creating conflicts with parameters. Try changing them to "/dm1" and "/dm2".

If you used zcmd and sscanf I could help you more
Reply
#3

Quote:
Originally Posted by biltong
I think maybe when you say "/dm 1" and "/dm 2" in OnPlayerCommandText you are creating conflicts with parameters. Try changing them to "/dm1" and "/dm2".

If you used zcmd and sscanf I could help you more
the problem is not in the onplayercommandtext but in the setplayerrandomspawn because i dont know how to use ispawnset and it teleports me to wrong places and all...
Reply
#4

bump
Reply
#5

http://forum.sa-mp.com/index.php?top...2966#msg902966

This may help you.
Reply
#6

Quote:
Originally Posted by clum``
can someone help me?...
i need to set seperate random teleports on command but it sends me to both...
Reply
#7

wtf... NO BODY KNOWS? NOOBS!
joke but really help me .
Reply
#8

Quote:
Originally Posted by jamesbond007
wtf... NO BODY KNOWS? NOOBS!
joke but really help me .
bump
Reply
#9

someone help bump bump
Reply
#10

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)