SA-MP Forums Archive
[FilterScript] [FS]Mine System - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] [FS]Mine System (/showthread.php?tid=355154)



[FS]Mine System - Sig Hansen - 29.06.2012

This fs add to your server the ability to install mine.

Commands:
/ mine-mine setting

-Each player can have only 1 minute. Following a mine can be placed after the first burst.
-After installation, run 10 second timer, after which the mine is activated and after every player will be on it, it will work.


PasteBin: http://pastebin.com/bhH6jEm3

Leave me a comment + rep, Thank You


Re: [FS]Mine System - newbienoob - 29.06.2012

Looks similar to this
https://sampforum.blast.hk/showthread.php?tid=292233


Re: [FS]Mine System - Sig Hansen - 29.06.2012

But is a diffrent.....


Re: [FS]Mine System - newbienoob - 29.06.2012

"Your" script

pawn Код:
/*
 ==================================================
 |[FS]Mine by Sig Hansen and Shane Beddow         |
 ==================================================
*/


#include <a_samp>

#define WHITE   0xFFFFFFFF

new countpos[MAX_PLAYERS];
new timer[MAX_PLAYERS];
new Text3D:laber[MAX_PLAYERS];
new mine[MAX_PLAYERS][2];
new status[MAX_PLAYERS];
new minePickup[MAX_PLAYERS];

public OnFilterScriptInit()
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext,"/mine",true)==0)
    {
        if (IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessage(playerid, WHITE, " You're in the car, so you are prohibited from using the command!!");
            return 1;
        }
        if(status[playerid] == 1)
        {
            SendClientMessage(playerid, WHITE, " You have already established a mine!");
            return 1;
        }
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        mine[playerid][0] = CreateObject(2992, X, Y, Z-0.85, 0.0, 0.0, 0.0);
        mine[playerid][1] = CreateObject(19290, X, Y, Z-0.85, 0.0, 0.0, 0.0);
        status[playerid] = 1;
        countpos[playerid] = 11;
        dtext(playerid);
        return 1;
    }
    return 0;
}



forward dtext(playerid);
public dtext(playerid)
{
    timer[playerid] = SetTimerEx("dtext", 1000, 0, "i", playerid);
    new Float:X, Float:Y, Float:Z;
    GetObjectPos(mine[playerid][0], X, Y, Z);
    if(countpos[playerid] == 11)
    {
        laber[playerid] = Create3DTextLabel("to activate the left: \n10 seconds!",0x00F900AA,X,Y,Z+1,40.0,0);
        countpos[playerid] = 10;
    }
    else if(countpos[playerid] == 10)
    {
        Update3DTextLabelText(laber[playerid], 0x64F801AA, "to activate the left: \n9 seconds!");
        countpos[playerid] = 9;
    }
    else if(countpos[playerid] == 9)
    {
        Update3DTextLabelText(laber[playerid], 0xBAF801AA, "to activate the left: \n8 seconds!");
        countpos[playerid] = 8;
    }
    else if(countpos[playerid] == 8)
    {
        Update3DTextLabelText(laber[playerid], 0xDAF900AA, "to activate the left: \n7 seconds!");
        countpos[playerid] = 7;
    }
    else if(countpos[playerid] == 7)
    {
        Update3DTextLabelText(laber[playerid], 0xFCEB18AA, "to activate the left: \n6 seconds!");
        countpos[playerid] = 6;
    }
    else if(countpos[playerid] == 6)
    {
        Update3DTextLabelText(laber[playerid], 0xFCCE18AA, "to activate the left: \n5 seconds!");
        countpos[playerid] = 5;
    }
    else if(countpos[playerid] == 5)
    {
        Update3DTextLabelText(laber[playerid], 0xFBA71AAA, "to activate the left: \n4 seconds!");
        countpos[playerid] = 4;
    }
    else if(countpos[playerid] == 4)
    {
        Update3DTextLabelText(laber[playerid], 0xFA6F1BAA, "to activate the left: \n3 seconds!");
        countpos[playerid] = 3;
    }
    else if(countpos[playerid] == 3)
    {
        Update3DTextLabelText(laber[playerid], 0xFA421BAA, "to activate the left: \n2 seconds!");
        countpos[playerid] = 2;
    }
    else if(countpos[playerid] == 2)
    {
        Update3DTextLabelText(laber[playerid], 0xFF0F0FAA, "to activate the left: \n1 second!");
        countpos[playerid] = 1;
    }
    else if(countpos[playerid] == 1)
    {

        KillTimer(timer[playerid]);
        Delete3DTextLabel(laber[playerid]);
        countpos[playerid] = 0;
        minePickup[playerid] = CreatePickup(0, 1, X, Y, Z, -1);
    }
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) {continue;}
        if(status[i] == 0) {continue;}
        if(pickupid == minePickup[i])
        {
            new Float:X, Float:Y, Float:Z;
            GetObjectPos(mine[i][0], X, Y, Z);
            CreateExplosion(X, Y, Z, 7, 1);
            DestroyPickup(minePickup[i]);
            DestroyObject(mine[i][0]);
            DestroyObject(mine[i][1]);
            status[i] = 0;
        }
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(status[playerid] == 1)
    {
        DestroyPickup(minePickup[playerid]);
        DestroyObject(mine[playerid][0]);
        DestroyObject(mine[playerid][1]);
        status[playerid] = 0;
        KillTimer(timer[playerid]);
        Delete3DTextLabel(laber[playerid]);
    }
    return 1;
}
Original script
pawn Код:
//-----Mines---
forward dtext(playerid);
forward vdtext(playerid);

//------Mines--------
new countpos[MAX_PLAYERS];
new timer[MAX_PLAYERS];
new Text3D:laber[MAX_PLAYERS];
new mine[MAX_PLAYERS][2];
new status[MAX_PLAYERS];
new minePickup[MAX_PLAYERS];

new vcountpos[MAX_PLAYERS];
new vtimer[MAX_PLAYERS];
new Text3D:vlaber[MAX_PLAYERS];
new vmine[MAX_PLAYERS][2];
new vstatus[MAX_PLAYERS];
new vminePickup[MAX_PLAYERS];

public dtext(playerid)
{
    timer[playerid] = SetTimerEx("dtext", 1000, 0, "i", playerid);
    new Float:X, Float:Y, Float:Z;
    GetObjectPos(mine[playerid][0], X, Y, Z);
    if(countpos[playerid] == 11)
    {
        laber[playerid] = Create3DTextLabel("to activate the left: \n10 seconds!",0x00F900AA,X,Y,Z+1,40.0,0);
        countpos[playerid] = 10;
    }
    else if(countpos[playerid] == 10)
    {
        Update3DTextLabelText(laber[playerid], 0x64F801AA, "to activate the left: \n9 seconds!");
        countpos[playerid] = 9;
    }
    else if(countpos[playerid] == 9)
    {
        Update3DTextLabelText(laber[playerid], 0xBAF801AA, "to activate the left: \n8 seconds!");
        countpos[playerid] = 8;
    }
    else if(countpos[playerid] == 8)
    {
        Update3DTextLabelText(laber[playerid], 0xDAF900AA, "to activate the left: \n7 seconds!");
        countpos[playerid] = 7;
    }
    else if(countpos[playerid] == 7)
    {
        Update3DTextLabelText(laber[playerid], 0xFCEB18AA, "to activate the left: \n6 seconds!");
        countpos[playerid] = 6;
    }
    else if(countpos[playerid] == 6)
    {
        Update3DTextLabelText(laber[playerid], 0xFCCE18AA, "to activate the left: \n5 seconds!");
        countpos[playerid] = 5;
    }
    else if(countpos[playerid] == 5)
    {
        Update3DTextLabelText(laber[playerid], 0xFBA71AAA, "to activate the left: \n4 seconds!");
        countpos[playerid] = 4;
    }
    else if(countpos[playerid] == 4)
    {
        Update3DTextLabelText(laber[playerid], 0xFA6F1BAA, "to activate the left: \n3 seconds!");
        countpos[playerid] = 3;
    }
    else if(countpos[playerid] == 3)
    {
        Update3DTextLabelText(laber[playerid], 0xFA421BAA, "to activate the left: \n2 seconds!");
        countpos[playerid] = 2;
    }
    else if(countpos[playerid] == 2)
    {
        Update3DTextLabelText(laber[playerid], 0xFF0F0FAA, "to activate the left: \n1 second!");
        countpos[playerid] = 1;
    }
    else if(countpos[playerid] == 1)
    {

        KillTimer(timer[playerid]);
        Delete3DTextLabel(laber[playerid]);
        countpos[playerid] = 0;
        minePickup[playerid] = CreatePickup(0, 1, X, Y, Z, -1);
    }
    return 1;
}
public vdtext(playerid)
{
    vtimer[playerid] = SetTimerEx("vdtext", 1000, 0, "i", playerid);
    new Float:X, Float:Y, Float:Z;
    GetObjectPos(vmine[playerid][0], X, Y, Z);
    if(vcountpos[playerid] == 11)
    {
        vlaber[playerid] = Create3DTextLabel("to activate the left: \n10 seconds!",0x00F900AA,X,Y,Z+1,40.0,0);
        vcountpos[playerid] = 10;
    }
    else if(vcountpos[playerid] == 10)
    {
        Update3DTextLabelText(vlaber[playerid], 0x64F801AA, "to activate the left: \n9 seconds!");
        vcountpos[playerid] = 9;
    }
    else if(vcountpos[playerid] == 9)
    {
        Update3DTextLabelText(vlaber[playerid], 0xBAF801AA, "to activate the left: \n8 seconds!");
        vcountpos[playerid] = 8;
    }
    else if(vcountpos[playerid] == 8)
    {
        Update3DTextLabelText(vlaber[playerid], 0xDAF900AA, "to activate the left: \n7 seconds!");
        vcountpos[playerid] = 7;
    }
    else if(vcountpos[playerid] == 7)
    {
        Update3DTextLabelText(vlaber[playerid], 0xFCEB18AA, "to activate the left: \n6 seconds!");
        vcountpos[playerid] = 6;
    }
    else if(vcountpos[playerid] == 6)
    {
        Update3DTextLabelText(vlaber[playerid], 0xFCCE18AA, "to activate the left: \n5 seconds!");
        vcountpos[playerid] = 5;
    }
    else if(vcountpos[playerid] == 5)
    {
        Update3DTextLabelText(vlaber[playerid], 0xFBA71AAA, "to activate the left: \n4 seconds!");
        vcountpos[playerid] = 4;
    }
    else if(vcountpos[playerid] == 4)
    {
        Update3DTextLabelText(vlaber[playerid], 0xFA6F1BAA, "to activate the left: \n3 seconds!");
        vcountpos[playerid] = 3;
    }
    else if(vcountpos[playerid] == 3)
    {
        Update3DTextLabelText(vlaber[playerid], 0xFA421BAA, "to activate the left: \n2 seconds!");
        vcountpos[playerid] = 2;
    }
    else if(vcountpos[playerid] == 2)
    {
        Update3DTextLabelText(vlaber[playerid], 0xFF0F0FAA, "to activate the left: \n1 second!");
        vcountpos[playerid] = 1;
    }
    else if(vcountpos[playerid] == 1)
    {

        KillTimer(vtimer[playerid]);
        Delete3DTextLabel(vlaber[playerid]);
        vcountpos[playerid] = 0;
        vminePickup[playerid] = CreatePickup(0, 14, X, Y, Z, -1);
    }
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) {continue;}
        if(status[i] == 0) {continue;}
        if(pickupid == minePickup[i])
        {
            new Float:X, Float:Y, Float:Z;
            GetObjectPos(mine[i][0], X, Y, Z);
            CreateExplosion(X, Y, Z, 4, 1);
            CreateExplosion(X, Y, Z, 12, 1);
            DestroyPickup(minePickup[i]);
            DestroyObject(mine[i][0]);
            DestroyObject(mine[i][1]);
            status[i] = 0;
            GameTextForPlayer(playerid,"~r~You have stepped on a mine!",6000,1);
        }
    }
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) {continue;}
        if(vstatus[i] == 0) {continue;}
        if(pickupid == vminePickup[i])
        {
            new Float:X, Float:Y, Float:Z;
            GetObjectPos(vmine[i][0], X, Y, Z);
            CreateExplosion(X, Y, Z, 7, 1);
            DestroyPickup(vminePickup[i]);
            DestroyObject(vmine[i][0]);
            vstatus[i] = 0;
            GameTextForPlayer(playerid,"~r~You have driven over a mine!",6000,1);
        }
    }
    return 1;
}

CMD:vmine(playerid, params[])
{
        if (IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessage(playerid, WHITE, " You're in the car, so you are prohibited from using the command!!");
            return 1;
        }
        if(vstatus[playerid] == 1)
        {
            SendClientMessage(playerid, WHITE, " You have already established a mine!");
            return 1;
        }
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        vmine[playerid][0] = CreateObject(1213, X, Y, Z-0.85, 0.0, 0.0, 0.0);
        vstatus[playerid] = 1;
        vcountpos[playerid] = 11;
        vdtext(playerid);
        return 1;
    }
CMD:mine(playerid, params[])
    {
        if (IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessage(playerid, WHITE, " You're in the car, so you are prohibited from using the command!!");
            return 1;
        }
        if(status[playerid] == 1)
        {
            SendClientMessage(playerid, WHITE, " You have already established a mine!");
            return 1;
        }
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        mine[playerid][0] = CreateObject(1213, X, Y, Z-0.85, 0.0, 0.0, 0.0);
        status[playerid] = 1;
        countpos[playerid] = 11;
        dtext(playerid);
        return 1;
    }



Re: [FS]Mine System - Sig Hansen - 29.06.2012

So you just don't like new people script for SAMP? Because you are Huge Clocker this doesn't mean you rule....


Re: [FS]Mine System - newbienoob - 29.06.2012

Quote:
Originally Posted by Sig Hansen
Посмотреть сообщение
So you just don't like new people script for SAMP?
I didn't say that. But.. I don't like if someone stole other people's work. Oh btw, what happened to this?
https://sampforum.blast.hk/showthread.php?tid=355155
Deleted?


Re: [FS]Mine System - justsomeguy - 29.06.2012

Quote:
Originally Posted by Sig Hansen
Посмотреть сообщение
So you just don't like new people script for SAMP? Because you are Huge Clocker this doesn't mean you rule....
No, he is not saying that, *Noobvoice*:"But he does have more posts! Sow he is better!".
He is kinda right, your script IS very simular, wich is suspicious.
Don't start flaming instantly, this will only get you banned.


Re: [FS]Mine System - pasha97 - 29.06.2012

coola & great!