Hitman C4 - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Hitman C4 (
/showthread.php?tid=238432)
Fixed. -
Ifreezesir - 11.03.2011
Fixed.
Re: Hitman C4 -
[BKR]LUCAGRABACR - 12.03.2011
Try add this below the /plantbomb and above the "else's".
pawn Код:
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x, y, z);
SetPVarFloat(playerid, "C4x", x);
SetPVarFloat(playerid, "C4y", y);
SetPVarFloat(playerid, "C4z", z);
c4planted[playerid]=1;
And add this on top of your script
pawn Код:
new c4planted [MAX_PLAYERS];
Then make a new command rather than press lmb, like /detonate, and below it you add
pawn Код:
{
if c4planted[playerid]=1;
CreateExplosion(playerid, GetPVarFloat(playerid, "C4x"), GetPVarFloat(playerid, "C4y"), GetPVarFloat(playerid, "C4z"), 0, 10);
return 1;
}
if c4planted[playerid]=0;
{
SendClientMessage(playerid, COLOR_GRAD2, "You don't have a c4 planted");
return 1;
}
Idk if it will work or not lol, but that's the point if you got what I mea (I'm using a cellphone atm btw, so it's kinda hard to do it.
Re: Hitman C4 -
Gh0sT_ - 12.03.2011
Command:
pawn Код:
if( strcmp( cmdtext, "/plantbomb", true ) == 0 )
{
if( PlayerInfo[ playerid ][ pBombs ] == 0 ) return SendClientMessage( playerid, COLOR_GRAD2, " You don't have any C4 Explosives !" );
if( IsPlayerInAnyVehicle( playerid ) ) return SendClientMessage( playerid, COLOR_GRAD2, " You can't do that while in a vehicle !" );
if( PlayerTied[ playerid ] != 0 || PlayerCuffed[ playerid ] != 0 || PlayerFrozen[ playerid ] != 0 ) return SendClientMessage(playerid, COLOR_GREY, " You can't do that at this time !" );
new
Float: Position[ 4 ]
;
GetPlayerPos( playerid, Position[ 0 ], Position[ 1 ], Position[ 2 ] );
GetPlayerFacingAngle( playerid, Position[ 3 ] );
SetPVarFloat( playerid, "X", Position[ 0 ] );
SetPVarFloat( playerid, "Y", Position[ 1 ] );
SetPVarFloat( playerid, "Z", Position[ 2 ] );
SetPVarFloat( playerid, "A", Position[ 3 ] );
SetPVarInt( playerid, "pBomb", 1 );
ApplyAnimation( playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0 );
DestroyObject( BombID[ playerid ] );
Pozicija[ 0 ] += ( 1 * floatsin( -A, degrees ) );
Pozicija[ 1 ] += ( 1 * floatcos( -A, degrees ) );
BombID[ playerid ] = CreateObject( 1654, Position[ 0 ], Position[ 1 ], Position[ 2 ] - 0.9, 0, 90, 0 );
GivePlayerGun( playerid, 40 );
PlayerInfo[ playerid ][ pBombs ] --;
SendClientMessage( playerid, COLOR_LIGHTBLUE, "* You have placed the C4, the device is now armed." );
return true;
}
and key checking:
pawn Код:
if( newkeys & YOUR KEY )
{
if( GetPVarInt( playerid, "pBomb" ) == 1 )
{
SetPVarInt( playerid, "pBomb", 0 );
CreateExplosion( playerid, GetPVarFloat( playerid, "X" ), GetPVarFloat( playerid, "Y" ), GetPVarFloat(playerid, "Z" ), 0, 10 );
// and another shit you want...
}
}