01.11.2011, 03:25
(
Последний раз редактировалось Norn; 01.11.2011 в 20:23.
)
v0.1.1
nObject Cycle is a simple include that allows you to dynamically create cycling objects, basically it will go from one point to another and then cycle back through the positions until it meets the original position, then restarting the entire process.The seconds variable in recording is the amount of time in which a new cycle point will be created based on the players position.
[ame]http://www.youtube.com/watch?v=UMwVDG74Xqw&feature=player_embedded[/ame]
[ame]http://www.youtube.com/watch?v=G2N6LrcZmpk[/ame]
Example record command:
pawn Код:
COMMAND:noc_record(playerid,params[])
{
if(!GetPVarInt(playerid, "nocRecording")) {
new mid, sec, Float:dgsped, fdgname[MAX_NOC_NODE_FLENGTH], Float:dd, string[128];
if (!sscanf(params, "ddfsf", mid, sec, dgsped, fdgname, dd)) {
if(NOC_VALIDO(mid)) {
if(strlen(fdgname) <= MAX_NOC_NODE_FLENGTH) {
NOC_RecordCycle(playerid, mid, sec, dgsped, fdgname, dd);
}
else {
format(string, sizeof(string), "[NOC:] Filenames must be below or equal to %d characters in length.", MAX_NOC_NODE_FLENGTH);
SendClientMessage(playerid, COLOR_RED, string);
}
}
else {
SendClientMessage(playerid, COLOR_RED, "[ERROR:] Incorrect object model.");
}
}
else return SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] /noc_record <model> <seconds> <speed> <file> <drawdistance>");
}
else
{
NOC_StopRecord(playerid);
}
return true;
}
pawn Код:
new DERP_ID, SEAT, BENCH;
public OnGameModeInit()
{
DERP_ID = NOC_CreateObjectCycle(19335, 0.00, 0.00, 89.86, 300.00, "hot_air_balloon", 100.00);
BENCH = NOC_CreateObjectCycle(11470, 0.00, 0.00, 0.00, 300.00, "bench_ls_airport", 20.00);
SEAT = NOC_CreateObjectCycle(1562, 0.00, 0.00, 0.00, 300.00, "seat_ls_airport", 20.00);
NOC_StartCycle(DERP_ID);
NOC_StartCycle(BENCH);
NOC_StartCycle(SEAT);
return 1;
}
pawn Код:
forward NOC_Exists(nodeid);
forward NOC_ItemExists(nodeitemid);
forward NOC_StopCycle(nodeid);
forward NOC_StartCycle(nodeid);
forward NOC_CreateObjectCycle(modelid, Float:rX, Float:rY, Float:rZ, Float:DrawDistance, node[MAX_NOC_NODE_FLENGTH], Float:speed);
forward NOC_GetFromObjectID(objectid);
forward NOC_OnCycleChange(nodeid, change);
forward NOC_OnCycleReachedPoint(nodeid, point);
forward NOC_RecordCycle(playerid, model, seconds, Float:speed, nfname[MAX_NOC_NODE_FLENGTH], Float:drawdistance);
forward NOC_RecordTimer(playerid);
forward NOC_VALIDO( objectid );
forward NOC_StopRecord(playerid);
forward NOC_RFNOCOwnerSpace();
forward NOC_RFNOCNSpace();
forward NOC_ReturnObjectID(nodeid);
forward NOC_PauseCycle(nodeid);
forward NOC_CycleActive(nodeid);
forward NOC_ReloadCycle(nodeid);
forward NOC_SetSpeed(nodeid, speed);
forward NOC_CyclePointCount(nodeid);
pawn Код:
forward NOC_OnCycleChange(nodeid, change);
forward NOC_OnCycleReachedPoint(nodeid, point);
pawn Код:
public NOC_OnCycleChange(nodeid, change)
{
switch(change) {
case 0:
{
printf("[NOC] Cycle ID %d accelerated.", nodeid);
}
case 1:
{
printf("[NOC] Cycle ID %d reversed.", nodeid);
}
}
}
pawn Код:
public NOC_OnCycleReachedPoint(nodeid, point) {
if(nodeid == CAR_UNITY && point == 1)
{
NOC_PauseCycle(nodeid);
SetTimerEx("NOC_PauseCycle", 10000, false, "i", nodeid);
SendClientMessageToAll(COLOR_WHITE, "[INFO:] Tour car leaving Unity Station in 10 seconds.");
}
return true;
}
# Updates
Quote:
31/10/11: Object now faces the next position it's navigating to. 1/11/11: Functions NOC_PauseCycle(nodeid) NOC_CycleActive(nodeid) NOC_ReloadCycle(nodeid) NOC_SetSpeed(nodeid, speed) NOC_CyclePointCount(nodeid) 1/11/11: Callback NOC_OnCycleReachedPoint(nodeid, point) |