Szerző Téma: Bomb System  (Megtekintve 917 alkalommal)

Nem elérhető instant

  • 2778
  • ZzzzzZ
    • Profil megtekintése
Bomb System
« Dátum: 2011. szeptember 29. - 06:49:30 »
0 Show voters

#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 bomba felrobbantva\");
        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 bomba hatástastalanitva.\"),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\",\"Bomba vesz\\nbomba lerakás\\nBomba eladás\",\"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,\"Nem vagy közel a bomba lerakohoz\");
        }
        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,\"Sikeresen vettél 1 bombát\");
                return havebomb[playerid]++;
            }
            if(listitem == 1)
            {
                if(havebomb[playerid] >= 1)
                {
                    new strleo[27];
                    format(strleo,sizeof(strleo),\"neked van % bombád\",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,\"Neked nincsen bombád!!\"); }
                return havebomb[playerid]--;
            }
            if(listitem == 2)
            {
                if(havebomb[playerid] >= 1)
                {
                    SendClientMessage(playerid,0x008000FF,\"Sikeresen eladtad a bombát\");
                    GivePlayerMoney(playerid,5000);
                }
                else { SendClientMessage(playerid,0xFF0000FF,\"Neked nincsen bombád!!\"); }
                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();
}

 
Készitette:Leeo_Perez
Video rola:http://www.youtube.com/watch?v=LSTsudBcKjI&feature=player_embedded#!
Eredeti link:  http://forum.sa-mp.com/showthread.php?t=285922
« Utoljára szerkesztve: 2011. november 12. - 18:10:15 írta APC »

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal