SA-MP Forums Archive
Minefield - 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: Minefield (/showthread.php?tid=393831)



Minefield - SilencedPistol - 20.11.2012

Im new to scripting, I created a map for an FBI faction and I want to make it so that only members of the faction can enter without being blown up. Any other player (not admins) must be destroyed. Like a minefield. Help!


Re: Minefield - jakejohnsonusa - 20.11.2012

I'm new to scripting also, but I will give this question a try. Try somthing like this:


pawn Код:
if(IsPlayerInRangeOfPoint(playerid, x,y,z)
{
if(IsAFBI(playerid) /*(use whatever you use in your GM to specify their job)*/ return 1;
new playerid;
new Float:boomx, Float:boomy, Float:boomz;
GetPlayerPos(playerid,boomx, boomy, boomz);
CreateExplosion(boomx, boomy , boomz, 7, 1);
}



Re: Minefield - 2KY - 20.11.2012

Quote:
Originally Posted by jakejohnsonusa
Посмотреть сообщение
I'm new to scripting also, but I will give this question a try. Try somthing like this:


pawn Код:
if(IsPlayerInRangeOfPoint(playerid, x,y,z)
{
if(IsAFBI(playerid) /*(use whatever you use in your GM to specify their job)*/ return 1;
new playerid;
new Float:boomx, Float:boomy, Float:boomz;
GetPlayerPos(playerid,boomx, boomy, boomz);
CreateExplosion(boomx, boomy , boomz, 7, 1);
}
Let me help you a bit..

pawn Код:
if( IsPlayerInRangeOfPoint( playerid, radius, x, y, z ) )
{
    if( IsAFBI( playerid ) )
        return false; // Allow them to continue on their merry way.
       
    new
        Float: MyPos [ 3 ];
       
    GetPlayerPos( playerid, MyPos [ 0 ], MyPos [ 1 ], MyPos [ 2 ] );
    // Gets their position and stores the X value as MyPos [ 0 ],
     // Y value as MyPos [ 1 ], and Z value as MyPos [ 2 ].
     
    CreateExplosion( MyPos [ 0 ], MyPos [ 1 ], MyPos [ 2 ], 7, 1 );
    // Creates an explosion at their position.
   
    SetPlayerHealth( playerid, 0.0 );
    // Since one explosion isn't going to kill them - set their health.
    return true;
}