SA-MP Forums Archive
Shoot Spawnpoint - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Shoot Spawnpoint (/showthread.php?tid=546397)



Shoot Spawnpoint - s0ZNIz - 15.11.2014

Hey guys,
i want to do that if player shooting spawn point that will kill him .
can anyone help me with that ?

ty


Re: Shoot Spawnpoint - StR_MaRy - 15.11.2014

search on ****** samp shoot spawn point


Re : Shoot Spawnpoint - Dutheil - 15.11.2014

OnPlayerWeaponShot & IsPlayerInRangeOfPoint (Optional)


Re: Shoot Spawnpoint - HY - 15.11.2014

pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(IsPlayerInRangeOfPoint(playerid, RANGE, X, Y, Z))
    {
        SetPlayerHealth(playerid, 0.0);
        SendClientMessage(playerid, -1, "You got killed, because you shooted in a Spawn Point !");
    }
    return 1;
}

/*

Replace X, Y, Z with your position of Spawn Point.
Replace Range with your distance, when he cannot shoot.

*/



Re: Shoot Spawnpoint - s0ZNIz - 20.11.2014

Quote:
Originally Posted by HY
Посмотреть сообщение
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(IsPlayerInRangeOfPoint(playerid, RANGE, X, Y, Z))
    {
        SetPlayerHealth(playerid, 0.0);
        SendClientMessage(playerid, -1, "You got killed, because you shooted in a Spawn Point !");
    }
    return 1;
}

/*

Replace X, Y, Z with your position of Spawn Point.
Replace Range with your distance, when he cannot shoot.

*/
that not what i need .
if player just walk in the range of the spawn point and shoot anywhere that kill him .
i need if the bullet hit the X Y Z of the spawn point that will kill him


Re: Shoot Spawnpoint - Rdx - 20.11.2014

Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
	if(hittype == BULLET_HIT_TYPE_NONE)
	{
	    if(fX == spawnX && fY == spawnY && fZ == spawnZ)
	    {
	        SetPlayerHealth(playerid, 0.0);
	    }
	}
    return 1;
}

//Replace spawnX, spawnY, spawnZ with your spawn positions.



Re : Shoot Spawnpoint - Dutheil - 20.11.2014

@Rdx : This isn't precise


Re: Shoot Spawnpoint - s0ZNIz - 20.11.2014

Quote:
Originally Posted by Rdx
Посмотреть сообщение
Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
	if(hittype == BULLET_HIT_TYPE_NONE)
	{
	    if(fX == spawnX && fY == spawnY && fZ == spawnZ)
	    {
	        SetPlayerHealth(playerid, 0.0);
	    }
	}
    return 1;
}

//Replace spawnX, spawnY, spawnZ with your spawn positions.
Not working


Re: Shoot Spawnpoint - Rdx - 20.11.2014

EDIT: try this, change your spawn positions and range in CHANGE fields.

Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
	new Float:spawnX = CHANGE;
	new Float:spawnY = CHANGE;
	new Float:spawnZ = CHANGE;
	new Float:range = 5.0 // CHANGE IT


    if(IsPointInRangeOfPoint(fX, fY, fZ, spawnX, spawnY, spawnZ, range))
    {
        SetPlayerHealth(playerid, 0.0);
        SendClientMessage(playerid, -1, "Don't spawnkill, you are dead.");
    }

    return 1;
}

stock IsPointInRangeOfPoint(Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2, Float:range)
{
    x2 -= x;
    y2 -= y;
    z2 -= z;
    return ((x2 * x2) + (y2 * y2) + (z2 * z2)) < (range * range);
}
EDIT2: tested, working : http://i.imgur.com/FShRdfP.jpg


Re: Shoot Spawnpoint - s0ZNIz - 20.11.2014

Quote:
Originally Posted by Rdx
Посмотреть сообщение
EDIT: try this, change your spawn positions and range in CHANGE fields.

Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
	new Float:spawnX = CHANGE;
	new Float:spawnY = CHANGE;
	new Float:spawnZ = CHANGE;
	new Float:range = 5.0 // CHANGE IT


    if(IsPointInRangeOfPoint(fX, fY, fZ, spawnX, spawnY, spawnZ, range))
    {
        SetPlayerHealth(playerid, 0.0);
        SendClientMessage(playerid, -1, "Don't spawnkill, you are dead.");
    }

    return 1;
}

stock IsPointInRangeOfPoint(Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2, Float:range)
{
    x2 -= x;
    y2 -= y;
    z2 -= z;
    return ((x2 * x2) + (y2 * y2) + (z2 * z2)) < (range * range);
}
EDIT2: tested, working : http://i.imgur.com/FShRdfP.jpg
Nope ..
i done it exactly like you said , but nothing i tried in diffrent ranges too