Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Block Pandemonium - Do it Yourself
- By Youarex
- Date: 3.7.2013
- http://www.youtube.com/watch?v=gzRQiSBik1k
- **************
- Callbacks:
- **************
- OnPlayerCaptureBlock:
- Called when a player captures a block.
- Paremeters:
- playerid - The player that captured the block.
- blockid - The block that was captured.
- Returns:
- Doesn't return a specific value.
- public OnPlayerCaptureBlock(playerid, blockid)
- {
- return 1;
- }
- **************
- Functions:
- **************
- Arena_Create:
- Creates the arena.
- Paremeters:
- Float:x - The X coordinate to create the arena at.
- Float:y - The Y coordinate to create the arena at.
- Float:z - The Z coordinate to create the arena at.
- Returns:
- Doesn't return a specific value.
- Arena_Create(Float:x, Float:y, Float:z);
- **************
- Arena_Destroy:
- Destroys the arena.
- Paremeters:
- No parameters.
- Returns:
- Doesn't return a specific value.
- Arena_Destroy();
- **************
- SetBlockColor:
- Changes the color of the block.
- Paremeters:
- blockid - The block to change the color of.
- color - The color to set, as an integer or hex (ARGB).
- Returns:
- Doesn't return a specific value.
- SetBlockColor(blockid, color);
- **************
- GetBlockColor:
- Returns the color of the block.
- Paremeters:
- blockid - The block you want to know the color of.
- GetBlockColor(blockid);
- **************
- SetBlockUniqueID
- Sets the unique ID to the block.
- Paremeters:
- blockid - The block to change the unique ID of.
- uniqueid - The unique ID to be set for the block.
- Returns:
- Doesn't return a specific value.
- SetBlockUniqueID(blockid, uniqueid);
- **************
- SetBlockUniqueID
- Returns the unique id of the block.
- Paremeters:
- blockid - The block you want to know the unique ID of.
- GetBlockUniqueID(blockid);
- **************
- */
- #define ARENA_SIZE 8 * 8
- #define blocks(%0) for(new %0; %0 < ARENA_SIZE; %0++)
- forward OnPlayerCaptureBlock(playerid, blockid);
- new stock
- bp_aGround[4],
- bp_aBtn[ARENA_SIZE],
- bp_aPickup[ARENA_SIZE],
- bp_aObject[ARENA_SIZE],
- bp_aColor[ARENA_SIZE],
- bp_aUniqueID[ARENA_SIZE],
- bool:bp_aCreated = false;
- static stock
- bool:s_gHasOPPP = false;
- static stock
- g_Filterscript;
- public OnFilterScriptInit()
- {
- bp_OnScriptInit();
- g_Filterscript = 1;
- if(funcidx("bp_OnFilterScriptInit") != -1)
- {
- return CallLocalFunction("bp_OnFilterScriptInit", "");
- }
- return 1;
- }
- #if defined _ALS_OnFilterScriptInit
- #undef OnFilterScriptInit
- #else
- #define _ALS_OnFilterScriptInit
- #endif
- #define OnFilterScriptInit bp_OnFilterScriptInit
- forward bp_OnFilterScriptInit();
- public OnGameModeInit()
- {
- if (!g_Filterscript)
- {
- bp_OnScriptInit();
- }
- if(funcidx("bp_OnGameModeInit") != -1)
- {
- return CallLocalFunction("bp_OnGameModeInit", "");
- }
- return 1;
- }
- #if defined _ALS_OnGameModeInit
- #undef OnGameModeInit
- #else
- #define _ALS_OnGameModeInit
- #endif
- #define OnGameModeInit bp_OnGameModeInit
- forward bp_OnGameModeInit();
- stock bp_OnScriptInit()
- {
- s_gHasOPPP = funcidx("bp_OnPlayerPickUpPickup") != -1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- if(bp_aCreated)
- {
- for(new blockid; blockid < ARENA_SIZE; blockid++)
- {
- if(pickupid == bp_aPickup[blockid])
- {
- CallRemoteFunction("OnPlayerCaptureBlock", "ii", playerid, blockid);
- break;
- }
- }
- }
- if(s_gHasOPPP)
- {
- return CallLocalFunction("bp_OnPlayerPickUpPickup", "ii", playerid, pickupid);
- }
- return 1;
- }
- #if defined _ALS_OnPlayerPickUpPickup
- #undef OnPlayerPickUpPickup
- #else
- #define _ALS_OnPlayerPickUpPickup
- #endif
- #define OnPlayerPickUpPickup bp_OnPlayerPickUpPickup
- forward bp_OnPlayerPickUpPickup(playerid, pickupid);
- stock SetBlockColor(blockid, color)
- {
- if(bp_aCreated)
- {
- bp_aColor[blockid] = color;
- SetObjectMaterial(bp_aObject[blockid], 0, 8398, "luxorland", "des_dirt1", color);
- }
- }
- stock GetBlockColor(blockid)
- {
- if(bp_aCreated)
- {
- return bp_aColor[blockid];
- }
- return -1;
- }
- stock SetBlockUniqueID(blockid, uniqueid)
- {
- if(bp_aCreated)
- {
- bp_aUniqueID[blockid] = uniqueid;
- }
- }
- stock GetBlockUniqueID(blockid)
- {
- if(bp_aCreated)
- {
- return bp_aUniqueID[blockid];
- }
- return -1;
- }
- stock Arena_Create(Float:bp_pos_x, Float:bp_pos_y, Float:bp_pos_z)
- {
- if(!bp_aCreated)
- {
- new
- Float:tmp_x = bp_pos_x;
- bp_aGround[0] = CreateObject(18981, bp_pos_x -12.499999, bp_pos_y -12.499998, bp_pos_z +1.970000, 0.000000, 90.000000, 0.000000, 400.00);
- SetObjectMaterial(bp_aGround[0], 0, 19373, "all_walls", "desgreengrass", 0);
- bp_aGround[1]= CreateObject(18981, bp_pos_x -12.499999, bp_pos_y +12.500001, bp_pos_z +1.970000, 0.000007, 89.999992, 270.000000, 400.00);
- SetObjectMaterial(bp_aGround[1], 0, 19373, "all_walls", "desgreengrass", 0);
- bp_aGround[2] = CreateObject(18981, bp_pos_x +12.500000, bp_pos_y +12.500004, bp_pos_z +1.970000, 0.000006, 90.000000, 180.000030, 400.00);
- SetObjectMaterial(bp_aGround[2], 0, 19373, "all_walls", "desgreengrass", 0);
- bp_aGround[3] = CreateObject(18981, bp_pos_x +12.500014, bp_pos_y -12.499995, bp_pos_z +1.970000, 0.000005, 90.000000, 90.000068, 400.00);
- SetObjectMaterial(bp_aGround[3], 0, 19373, "all_walls", "desgreengrass", 0);
- for(new i; i < ARENA_SIZE; i++)
- {
- bp_aColor[i] = 0xFFFFFFFF;
- bp_aUniqueID[i] = -1;
- if(i % 8 == 0 && i != 0)
- {
- bp_pos_x = tmp_x;
- bp_pos_y += 5.7;
- }
- bp_aObject[i] = CreateObject(18764, bp_pos_x -19.991994, bp_pos_y -19.991994, bp_pos_z +0.005, 0.00, 0.00, 0.00, 400.00);
- bp_aBtn[i] = CreateObject(18762, bp_pos_x -19.991994, bp_pos_y -19.991994, bp_pos_z +0.009, 0.00, 0.00, 0.00, 400.00);
- SetObjectMaterial(bp_aObject[i], 0, 8398, "luxorland", "des_dirt1", 0xFFFFFFFF);
- bp_aPickup[i] = CreatePickup(19300, 1, bp_pos_x -19.991994, bp_pos_y -19.991994, bp_pos_z +4.00, -1);
- bp_pos_x += 5.7;
- }
- bp_aCreated = true;
- }
- }
- stock Arena_Destroy()
- {
- if(bp_aCreated)
- {
- for(new i; i < ARENA_SIZE; i++)
- {
- DestroyObject(bp_aObject[i]);
- DestroyObject(bp_aBtn[i]);
- DestroyPickup(bp_aPickup[i]);
- if(i < sizeof bp_aGround)
- {
- DestroyObject(bp_aGround[i]);
- }
- }
- bp_aCreated = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement