Shoot Spawnpoint
#1

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

ty
Reply
#2

search on ****** samp shoot spawn point
Reply
#3

OnPlayerWeaponShot & IsPlayerInRangeOfPoint (Optional)
Reply
#4

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.

*/
Reply
#5

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
Reply
#6

Код:
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.
Reply
#7

@Rdx : This isn't precise
Reply
#8

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
Reply
#9

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
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)