![]() |
#1 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2012
Posts: 4,852
Reputation: 1313
|
![]()
Checkpoint / Area Sub-Streamer
These includes help organize your checkpoints and areas into macro functions which avoids the hassle of having a lot of code in OnPlayerEnterDynamicCP(), OnPlayerLeaveDynamicCP(), OnPlayerEnterDynamicArea() and OnPlayerLeaveDynamicArea(). There is a trade off with this you will lose a bit of efficiency since the sub-streamer needs to search through the array to look up which CP/Area has been triggered. Usage: Areas Code:
stock AddDynamicSphereArea(Float:x, Float:y, Float:z, Float:size, AName[], worldid = -1, interiorid = -1, playerid = -1) stock AddDynamicCubeArea(Float:minx, Float:miny, Float:minz, Float:maxx, Float:maxy, Float:maxz, AName[], worldid = -1, interiorid = -1, playerid = -1) stock RemoveDynamicArea(areaindex) Code:
stock AddDynamicCP(Float:x, Float:y, Float:z, Float:size, CName[], worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0) stock RemoveDynamicCheckPoint(cpindex) Code:
#include <dynamicarea> public OnGameModeInit() { AddDynamicSphereArea(1000.0, 1000.0, 1000.0, 4.0, "TestArea"); } OnArea:TestArea(playerid, areaid, areaindex) { SendClientMessage(playerid, "You entered the TestArea"); return 1; } ExitArea:TestArea(playerid, areaid, areaindex) { SendClientMessage(playerid, "You left the TestArea"); return 1; } Code:
#include <dynamiccp> public OnGameModeInit() { AddDynamicCP(1000.0, 1000.0, 1000.0, 2.0, "TestCP") } OnCheckPoint:TestCP(playerid, cpid, cpindex) { SendClientMessage(playerid, "You entered the TestCP"); return 1; } ExitCheckPoint:TestCP(playerid, cpid, cpindex) { SendClientMessage(playerid, "You left the TestCP"); return 1; } areaid = Area ID in the streamer areaindex = Area index in the sub-streamer cpid = Checkpoint ID in the streamer cpindex = Checkpoint Index in the substreamer You can use multiple macro references to call a single macro. Code:
AddDynamicSphereArea(2000.0, 1000.0, 1000.0, 4.0, "TestArea"); AddDynamicSphereArea(3000.0, 1000.0, 1000.0, 4.0, "TestArea"); AddDynamicSphereArea(4000.0, 1000.0, 1000.0, 4.0, "TestArea"); |
![]() |
![]() |
![]() |
#2 |
Huge Clucker
![]() ![]() ![]() Join Date: Jul 2009
Location: Hell. x_x
Posts: 276
Reputation: 68
|
![]()
I didn't checked this but from the information you wrote, it seems pretty cool
![]() |
![]() |
![]() |
![]() |
#3 |
Huge Clucker
![]() ![]() ![]() Join Date: Feb 2012
Posts: 340
Reputation: 21
|
![]()
I havn't tested this yet, but this is a really great idea. From the sounds of this though the more checkpoints and areas you use the slower it will be is that correct?
|
![]() |
![]() |
![]() |
#4 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Aug 2011
Location: ヽ༼ຈل͜ຈ༽ノ
Posts: 2,180
Reputation: 311
|
![]()
From what I see, hard work, and for that, first of all, congrats. But, I probably didn't get this much since you didn't explain much. On your note that it reduces the 'hassle' of a lot of code under one call back, I find (personal opinion) it quite easier to group all checkpoint checks under one callback rather than two for each. So can you explain a bit more about this?
|
![]() |
![]() |
![]() |
#5 | |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2012
Posts: 4,852
Reputation: 1313
|
![]() Quote:
Code:
#include <dynamiccp> public OnGameModeInit() { AddDynamicCP(1000.0, 1000.0, 1000.0, 2.0, "TestCP1") AddDynamicCP(1000.0, 1000.0, 1000.0, 2.0, "TestCP2") AddDynamicCP(1000.0, 1000.0, 1000.0, 2.0, "TestCP3") AddDynamicCP(1000.0, 1000.0, 1000.0, 2.0, "TestCP4") } OnCheckPoint:TestCP1(playerid, cpid, cpindex) { SendClientMessage(playerid, "You entered the TestCP1"); return 1; } ExitCheckPoint:TestCP1(playerid, cpid, cpindex) { SendClientMessage(playerid, "You left the TestCP1"); return 1; } OnCheckPoint:TestCP2(playerid, cpid, cpindex) { SendClientMessage(playerid, "You entered the TestCP2"); return 1; } ExitCheckPoint:TestCP2(playerid, cpid, cpindex) { SendClientMessage(playerid, "You left the TestCP2"); return 1; } OnCheckPoint:TestCP3(playerid, cpid, cpindex) { SendClientMessage(playerid, "You entered the TestCP3"); return 1; } ExitCheckPoint:TestCP3(playerid, cpid, cpindex) { SendClientMessage(playerid, "You left the TestCP3"); return 1; } OnCheckPoint:TestCP4(playerid, cpid, cpindex) { SendClientMessage(playerid, "You entered the TestCP4"); return 1; } ExitCheckPoint:TestCP4(playerid, cpid, cpindex) { SendClientMessage(playerid, "You left the TestCP4"); return 1; } |
|
![]() |
![]() |
![]() |
#6 |
Banned
![]() Join Date: Oct 2013
Location: Croatia
Posts: 517
Reputation: 10
|
![]()
not work...
|
![]() |
![]() |
![]() |
#7 | |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2012
Posts: 4,852
Reputation: 1313
|
![]() Quote:
![]() |
|
![]() |
![]() |
![]() |
#8 |
Huge Clucker
![]() ![]() ![]() Join Date: Jan 2010
Posts: 223
Reputation: 25
|
![]()
Why don't you combine callbacks as one and add a parameter to see if player entered or leaved area/checkpoint?
It is better to have one callback per area/checkpoint, like commands or dynamic dialogs. From Code:
OnCheckPoint:TestCP1(playerid, cpid, cpindex) { SendClientMessage(playerid, "You entered the TestCP1"); return 1; } ExitCheckPoint:TestCP1(playerid, cpid, cpindex) { SendClientMessage(playerid, "You left the TestCP1"); return 1; } Code:
OnCheckPoint:TestCP1(playerid, cpid, cpindex,state) { if(state == STATE_ENTER) SendClientMessage(playerid, "You entered the TestCP1"); else if(state == STATE_EXIT) SendClientMessage(playerid, "You left the TestCP1"); return 1; } OnCheckPoint and OffCheckPoint or EnterCheckPoint and ExitCheckPoint |
![]() |
![]() |
![]() |
#9 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Aug 2010
Location: Somewhere i belong
Posts: 1,338
Reputation: 138
|
![]()
Much usefull. i always get trouble when checking such stuff, by trouble i mean some extra lines and never thought of spliting the things.
Also, how about gang zone too ? i mean like they do require somewhat calculation to check if player has entered certain gangzone "ID", can be a good addon to this include aswell ? (like: On Enter/Leave GangZone(playerid, gangzone_id_returned_from_CreateGangZone) btw it would be good if you add a pastebin link , maybe. |
![]() |
![]() |
![]() |
#10 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2012
Posts: 4,852
Reputation: 1313
|
![]()
You'd have to write your own gangzone streamer rectangular areas could work as a controller for 3D layered gangzones.
|
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
0.3 (C) To (E) Incognito Streamer Plugin | I3Psychedelic | Scripting Help | 7 | 31/12/2012 04:46 AM |
Incognito Streamer Checkpoint question | grekon | Scripting Help | 3 | 04/09/2011 09:34 PM |
Incognito's streamer plugin | sim_sima | Help Archive | 7 | 27/05/2011 11:27 AM |
incognito streamer plugin... | Whizion | Help Archive | 4 | 30/08/2010 02:05 PM |