- /bomb - 5 second delay
#1

Well I've been working on my first ever script & from scratch and I've stumbled into a problem

pawn Код:
if(strcmp("/bomb", cmdtext, true, 10) == 0) {//Explosion
        if(GetPlayerMoney(playerid) < 2500) return SendClientMessage(playerid,_COLOR_GREY,"You need $2,500 for this!");
        if (gTeam[playerid] == TEAM_TERRORIST) {
        new Float:X,Float:Y,Float:Z;
        GetPlayerPos(playerid,X,Y,Z);
        CreateExplosion(X,Y,Z,6,40.0);
        SetPlayerHealth(playerid, 0.0);
        GivePlayerMoney(playerid, -500);
        GameTextForPlayer(playerid,"~r~SUPRISE BLOWUP!",2500,5);
        SendClientMessage(playerid, _COLOR_RED, "You commited suicide and lost an extra $500!");}
        return 1;
How would I go on and give it a 5 second delay before it is typed again to prevent abuse when they die and such, thanks in advance.

ALSO -
How would I make it so when they press a dialog -
pawn Код:
if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid,_COLOR_GREY,"You cannot afford this!");
                {
                    SetPlayerArmour(playerid, 100);
                    GivePlayerMoney(playerid, -2000);
                    SendClientMessage(playerid, _COLOR_CYAN, "* You have choosen a Kevlar Vest!");
                    return 0;
It sends anyone close a message (Yes, using proxdetector but I haven't understood it yet) - for the purpose of determining a weapon hacker from a legit buyer.
Reply
#2

Quote:
Originally Posted by Darklom
Посмотреть сообщение
Well I've been working on my first ever script & from scratch and I've stumbled into a problem

pawn Код:
if(strcmp("/bomb", cmdtext, true, 10) == 0) {//Explosion
        if(GetPlayerMoney(playerid) < 2500) return SendClientMessage(playerid,_COLOR_GREY,"You need $2,500 for this!");
        if (gTeam[playerid] == TEAM_TERRORIST) {
        new Float:X,Float:Y,Float:Z;
        GetPlayerPos(playerid,X,Y,Z);
        CreateExplosion(X,Y,Z,6,40.0);
        SetPlayerHealth(playerid, 0.0);
        GivePlayerMoney(playerid, -500);
        GameTextForPlayer(playerid,"~r~SUPRISE BLOWUP!",2500,5);
        SendClientMessage(playerid, _COLOR_RED, "You commited suicide and lost an extra $500!");}
        return 1;
How would I go on and give it a 5 second delay before it is typed again to prevent abuse when they die and such, thanks in advance.
at the top of your script:
pawn Код:
new BombSpamPlayer[MAX_PLAYERS];
forward BombSpam(playerid);
Then place the callback:
pawn Код:
public BombSpam(playerid)
{
       if(BombSpamPlayer[playerid] == 1)
       {
             BombSpamPlayer[playerid] = 0;
             return 1;
        }
return 1;
}
Then modify your command:
pawn Код:
if(strcmp("/bomb", cmdtext, true, 10) == 0)
{
    if(GetPlayerMoney(playerid) < 2500) return SendClientMessage(playerid,_COLOR_GREY,"You need $2,500 for this!");
    if(BombSpamPlayer[playerid] == 1) return SendClientMessage(playerid,_COLOR_GREY, "You can use this command every 30 seconds!"); // Added this

        if (gTeam[playerid] == TEAM_TERRORIST)
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            CreateExplosion(X,Y,Z,6,40.0);
            SetPlayerHealth(playerid, 0.0);
            GivePlayerMoney(playerid, -500);
            GameTextForPlayer(playerid,"~r~SUPRISE BLOWUP!",2500,5);
            SendClientMessage(playerid, _COLOR_RED, "You commited suicide and lost an extra $500!");
            BombSpamPlayer[playerid] = 1; // Added this
            SetTimerEx("BombSpam", 5000, 0, "i", playerid); // Added a timer for a player only. 5000 milliseconds is 5 seconds.
        }
        return 1;
}
Reply
#3

//Mawking a new thread for this..
Reply
#4

How would I make it so when they press a dialog -
pawn Код:
if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid,_COLOR_GREY,"You cannot afford this!");
                {
                    SetPlayerArmour(playerid, 100);
                    GivePlayerMoney(playerid, -2000);
                    SendClientMessage(playerid, _COLOR_CYAN, "* You have choosen a Kevlar Vest!");
                    return 0;
It sends anyone close a message (Yes, using proxdetector but I haven't understood it yet) - for the purpose of determining a weapon hacker from a legit buyer.[

Anyone?

I'd say like "name chooses a kelvar vest"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)