[FilterScript] Bomb system
#1

> SCRIPT FEATURES <


includes SII and zcmd


video:

[ame]http://www.youtube.com/watch?v=LSTsudBcKjI[/ame]

pawn Код:
#include a_samp
#include SII

       
new
    havebomb[MAX_PLAYERS],
    Float:c[3],
    bomb[MAX_PLAYERS],
    nome[MAX_PLAYER_NAME],
    desarmou
;

forward
        planting(playerid);

public planting(playerid)
{
    if(desarmou == 1)
    {
        DestroyObject(bomb[playerid]);
        SendClientMessage(playerid,-1,"A bomb exploded");
        CreateExplosion(c[0],c[1],c[2],7,80.0);
        CreateExplosion(c[0],c[1],c[2],7,80.0);
        DestroyObject(bomb[playerid]);
    }
    else { SendClientMessageToAll(-1,"A bomb was disarmed with success."),DestroyObject(bomb[playerid]); }
    return 1;
}

public OnFilterScriptInit()
                return print("Bomb system by Leo_Perez loaded");
               
public OnFilterScriptExit()
                return print("Bomb system by Leo_Perez unloaded");

public OnPlayerDisconnect(playerid)
                return salvarbombs(playerid);
                       
public OnPlayerCommandText(playerid,cmdtext[])
{
    if(strcmp(cmdtext,"/bomb",true) == 0) return ShowPlayerDialog(playerid,9999,DIALOG_STYLE_LIST,"Bomb menu","bomb buy\nbomb plant\nSell bomb","Ok","Close");
    if(strcmp(cmdtext,"/desarmar",true) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,5.0,c[0],c[1],c[2]))
        {
            desarmou = 0;
            SendClientMessage(playerid,-1,"0x008000FF.");
        }
        else
        {
            desarmou = 1;
            SendClientMessage(playerid,-1,"You are not near the bomb");
        }
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 9999)
    {
        if(response)
        {
            if(listitem == 0)
            {
                if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid,-1,"not have enough money ($5000)");
                GivePlayerMoney(playerid,-5000);
                SendClientMessage(playerid,0x008000FF,"You bought a bomb");
                return havebomb[playerid]++;
            }
            if(listitem == 1)
            {
                if(havebomb[playerid] >= 1)
                {
                    new strleo[27];
                    format(strleo,sizeof(strleo),"do you have % bomb's",havebomb[playerid]);
                    SendClientMessage(playerid,0xFFFF00FF,strleo);
                    GetPlayerPos(playerid,c[0],c[1],c[2]);
                    SendClientMessage(playerid,0xFFFF00FF,"Run Run Run");
                    ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
                    bomb[playerid] = CreateObject(1252,c[0],c[1],c[2],-1,0.0,1.0);
                    SetTimerEx("planting",8000,false,"i",playerid);
                    desarmou = 1;
                }
                else { SendClientMessage(playerid,0xFF0000FF,"Do you not have a bomb!!"); }
                return havebomb[playerid]--;
            }
            if(listitem == 2)
            {
                if(havebomb[playerid] >= 1)
                {
                    SendClientMessage(playerid,0x008000FF,"Sold the bomb with success");
                    GivePlayerMoney(playerid,5000);
                }
                else { SendClientMessage(playerid,0xFF0000FF,"Do you not have a bomb!!"); }
                return havebomb[playerid]--;
            }
        }
    }
    return 1;
}
public OnPlayerDeath(playerid,killerid,reason) return havebomb[playerid] = false;

stock save(playerid)
{
    new file[28];
    GetPlayerName(playerid, nome, sizeof(nome));
    format(file, sizeof(file), "%s.ini",nome);
    INI_Open(file);
    INI_WriteInt("bombs",havebomb[playerid]);
    INI_Save();
    return INI_Close();
}

stock load(playerid)
{
    new file[28];
    GetPlayerName(playerid, nome, sizeof(nome));
    format(file, sizeof(file), "%s.ini",nome);
    INI_Open(file);
    havebomb[playerid] = INI_ReadInt("bombs");
    return INI_Close();
}

enjoy

sorry my bad english
Reply
#2

Quote:

> SCRIPT FEATURES <


includes SII and zcmd

Euhmm where's the ZCMD Commands? i don't see none...
Reply
#3

D:\GTA San Andreas\samp03dsvr_R2_win32\filterscripts\bombsyte m.pwn(32) : error 017: undefined symbol "salvarbombs"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)