OnPlayerSpawn bug
#1

the code is supposed to work that if player is in tdm and is a terrorist it respawns in a random pos in the terrorists area, and if player is in tdm and is not a terrorist (means he's a police) then he's respawned at a random pos in the police area after death, but they are spawned at the positions that normal players (not in tdm) are spawned in
Код:
new Float:TDMPoliceSpawn[][4]=
{
	{583.4468,932.7856,131.5688},
	{588.4707,924.7661,131.5688},
	{588.1059,916.0338,131.5688},
	{581.9496,908.8971,131.5688},
	{574.8304,912.1826,131.9484},
	{569.8643,919.2700,131.5688},
	{566.3352,928.5240,131.5688},
	{577.4505,914.9879,131.9457},
	{558.2061,910.8554,131.5688}
};
new Float:TDMTerroristSpawn[][4]=
{
	{509.9317,805.5425,131.5688},
	{516.7669,803.9371,131.5688},
	{527.6280,803.3882,131.5688},
	{529.2498,796.5878,131.5688},
	{538.2433,803.6035,131.5688},
	{537.7666,809.5430,131.5688},
	{520.7990,801.7632,131.5688},
	{532.2802,799.4874,131.5688},
	{537.2093,797.6714,131.5688},
	{506.5777,810.5068,131.5688}
};
public OnPlayerSpawn(playerid)
{
	if(PlayerInfo[playerid][ptdm] == 1 && PlayerInfo[playerid][pter] == 1)
	{
    	new rand = random(sizeof(TDMTerroristSpawn));
		SetPlayerPos(playerid, TDMTerroristSpawn[rand][0], TDMTerroristSpawn[rand][1], TDMTerroristSpawn[rand][2]);
		SetPlayerFacingAngle(playerid, TDMTerroristSpawn[rand][3]);
		SetPlayerHealth(playerid, 100);
		SetPlayerArmour(playerid, 20);
		ResetPlayerWeapons(playerid);
		GivePlayerWeapon(playerid,24,100);//deagle
		GivePlayerWeapon(playerid,27,150);//combat
		GivePlayerWeapon(playerid,28,200);//Micro SMG
		GivePlayerWeapon(playerid,31,120);//M4
		GivePlayerWeapon(playerid,34,100);//Sniper Rifle
	}
	if(PlayerInfo[playerid][ptdm] == 1 && PlayerInfo[playerid][pter] == 0)
	{
		new rand = random(sizeof(TDMPoliceSpawn));
		SetPlayerPos(playerid, TDMPoliceSpawn[rand][0], TDMPoliceSpawn[rand][1], TDMPoliceSpawn[rand][2]);
		SetPlayerFacingAngle(playerid, TDMPoliceSpawn[rand][3]);
		SetPlayerHealth(playerid, 100);
		SetPlayerArmour(playerid, 20);
		ResetPlayerWeapons(playerid);
		GivePlayerWeapon(playerid,24,100);//deagle
		GivePlayerWeapon(playerid,27,150);//combat
		GivePlayerWeapon(playerid,28,200);//Micro SMG
		GivePlayerWeapon(playerid,31,120);//M4
		GivePlayerWeapon(playerid,34,100);//Sniper Rifle
	}
        return 1;
}
any idea on whats wrong ?
Reply
#2

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][ptdm] == 1 && PlayerInfo[playerid][pter] == 1)
    {
        new rand = random(sizeof(TDMTerroristSpawn));
        SetPlayerPos(playerid, TDMTerroristSpawn[rand][0], TDMTerroristSpawn[rand][1], TDMTerroristSpawn[rand][2]);
        SetPlayerFacingAngle(playerid, TDMTerroristSpawn[rand][3]);
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 20);
        ResetPlayerWeapons(playerid);
        GivePlayerWeapon(playerid,24,100);//deagle
        GivePlayerWeapon(playerid,27,150);//combat
        GivePlayerWeapon(playerid,28,200);//Micro SMG
        GivePlayerWeapon(playerid,31,120);//M4
        GivePlayerWeapon(playerid,34,100);//Sniper Rifle
    }
    else if(PlayerInfo[playerid][ptdm] == 1 && PlayerInfo[playerid][pter] == 0)
    {
        new rand = random(sizeof(TDMPoliceSpawn));
        SetPlayerPos(playerid, TDMPoliceSpawn[rand][0], TDMPoliceSpawn[rand][1], TDMPoliceSpawn[rand][2]);
        SetPlayerFacingAngle(playerid, TDMPoliceSpawn[rand][3]);
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 20);
        ResetPlayerWeapons(playerid);
        GivePlayerWeapon(playerid,24,100);//deagle
        GivePlayerWeapon(playerid,27,150);//combat
        GivePlayerWeapon(playerid,28,200);//Micro SMG
        GivePlayerWeapon(playerid,31,120);//M4
        GivePlayerWeapon(playerid,34,100);//Sniper Rifle
    }
        return 1;
}
Untested, might work.
Reply
#3

nope, still the same
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)