[FilterScript] Police Car Mine System v1.0
#1

Police Car Mine System V 1.0
Hi SA-MP Community,

This is my third Filterscript. Hope you like it. So as the title says, Police Car Mine System, it is a FS for the police to drop a mine on the road. And if a vehicle steps on it except the police car, the mine will blow off! KABOOM!
Lets go for the explanation:
To drop a mine, a player must press Y key. Here is the code for it:
pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys == KEY_YES)
    {
        new vehicleid;
        vehicleid = GetPlayerVehicleID(playerid);
        if (IsPlayerInAnyVehicle(playerid) && GetVehicleModel(GetPlayerVehicleID(playerid)) != 597)
        {
            return 1;
        }
        else
        {
            new Float:plocx,Float:plocy,Float:plocz;
            GetVehiclePos(vehicleid, plocx, plocy, plocz);
            CreateMine(plocx,plocy,plocz);
        }
    }
    return 1;
}
We created the mine with this:
pawn Code:
new Float:plocx,Float:plocy,Float:plocz;
GetVehiclePos(vehicleid, plocx, plocy, plocz);
CreateMine(plocx,plocy,plocz);
Now when a player steps on mine in an vehicle, he must experience an explosion of type 7. Here is how we did it using OnPlayerUpdate:
pawn Code:
public OnPlayerUpdate(playerid)
{
    if(!IsPlayerConnected(playerid)) return 0;
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        for(new i = 0; i < sizeof(MineInfo); i++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 1, MineInfo[i][mX], MineInfo[i][mY], MineInfo[i][mZ]))
            {
                if(MineInfo[i][mCreated])
                {
                    if (IsPlayerInAnyVehicle(playerid) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 597)
                    {
                        return 1;
                    }
                    else
                    {
                        CreateExplosion(MineInfo[i][mX], MineInfo[i][mY], MineInfo[i][mZ], 7, 20.0);
                        DestroyObject(MineInfo[i][mObject]);
                    }
                    return 0;
                }
            }
         }
    }
    return 1;
}
The CreateMine function is build like this:
pawn Code:
stock CreateMine(Float:x,Float:y,Float:z)
{
    for(new i = 0; i < sizeof(MineInfo); i++)
    {
        if(MineInfo[i][mCreated] == 0)
        {
            MineInfo[i][mCreated]=1;
            MineInfo[i][mX]=x;
            MineInfo[i][mY]=y;
            MineInfo[i][mZ]=z-0.7;
            MineInfo[i][mObject] = CreateObject(364, x, y, z, 0, 0, 0);
            return 1;
        }
    }
    return 0;
}
Hope you got it.

Screenshots











This object (i.e. a detonator is our mine)

Credits

Faisal_khan for scripting.

Soon gonna release v2.0 for this with new features.

Pastebin


Reply
#2

Nice Scripte Keep it up bro with more reality +1
Reply
#3

Quote:
Originally Posted by BigBaws
View Post
Nice Scripte Keep it up bro with more reality +1
Thank you bro for the rep as well as your words.
Reply
#4

Cool Work Bro .. Keep Up 100/100
Reply
#5

hah, good idea and nice work 3
Reply
#6

Realy nice script,i like it i will try
Reply
#7

good work, but use the public OnPlayerUpdate can not be good idea ...
Reply
#8

Pretty unique I would say. Good job!
Reply
#9

Quote:
Originally Posted by Bruno Pereira
View Post
good work, but use the public OnPlayerUpdate can not be good idea ...
Thank you for the suggestion I will update it in v2.0

Quote:
Originally Posted by WarriorEd22
View Post
Pretty unique I would say. Good job!
Quote:
Originally Posted by [Dk]RoCk
View Post
Cool Work Bro .. Keep Up 100/100
Quote:
Originally Posted by System64
View Post
hah, good idea and nice work 3
Quote:
Originally Posted by sscarface
View Post
Realy nice script,i like it i will try
Thank you all!
Reply
#10

Guyz give me some suggestions for v2.0 which will be for 0.3e
Reply
#11

Cool Idea
And nice Script
Amazing!! Keep it up
Reply
#12

Quote:
Originally Posted by Phyrunx
View Post
Cool Idea
And nice Script
Amazing!! Keep it up
Thank you bro!
Reply
#13

For the next update. Add an optional int param as the type of mine. if 0 then it will be be Anti Vehicle. If it is 1 then if will Anti Vehicle as well as Anti Player. How about it?

Great work with this. Please add any other link. I cant download see source as idk why i cant access pastebin.com anymore.

Please use solidfiles or any other uploading site. Thanks [Rep+3]
Reply
#14

Awesome work,finally something unique here.
Reply
#15

Quote:
Originally Posted by Ballu Miaa
View Post
For the next update. Add an optional int param as the type of mine. if 0 then it will be be Anti Vehicle. If it is 1 then if will Anti Vehicle as well as Anti Player. How about it?

Great work with this. Please add any other link. I cant download see source as idk why i cant access pastebin.com anymore.

Please use solidfiles or any other uploading site. Thanks [Rep+3]
Updated, I added MediaFire link and I will do as u said in v2.0.

Quote:
Originally Posted by Logitech90
View Post
Awesome work,finally something unique here.
Thank you!
Reply
#16

Quote:
Originally Posted by Faisal_khan
View Post
Updated, I added MediaFire link and I will do as u said in v2.0.
Great brother. Thanks for updating the links for me Will be waiting for v2
Reply
#17

lol man why you always release your scripts i don't understand

They are sooo COOL scripts
Reply
#18

lol, nice script

Nobody had thought to do this script
Reply
#19

Quote:
Originally Posted by Ballu Miaa
View Post
Great brother. Thanks for updating the links for me Will be waiting for v2
Welcome dude!

Quote:
Originally Posted by MichaelProPlayer
View Post
lol man why you always release your scripts i don't understand

They are sooo COOL scripts
Thank you but as you said me earlier I will think of it nice idea.

Quote:
Originally Posted by javi
View Post
lol, nice script

Nobody had thought to do this script
Thank you!
Reply
#20

Very Nice Work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)