Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <streamer>
- forward OnPlayerEnterChurchMenu(playerid, churchid);
- forward OnPlayerExitChurchMenu(playerid, churchid);
- forward OnPlayerEnterChurch(playerid, churchid);
- forward OnPlayerEnterCEPoint(playerid, churchid);
- forward OnPlayerEnterChurchVehicle(playerid, vehicleid, ispassenger);
- forward OnPlayerExitChurchVehicle(playerid, vehicleid);
- forward OnPlayerEnterChurchMission(playerid);
- forward OnPlayerEnterChurchMissionEx(playerid);
- #if !defined _ALS_
- forward public _ALS_();
- _ALS_()<_ALS_:unhooked>{}
- _ALS_()<_ALS_:hooked>{}
- _ALS_()<>{}
- #endif
- #define MAX_EPOINT 50
- #define MAX_CHURCH 50
- enum E_SAMP_CHURCH
- {
- Float:churchx,
- Float:churchy,
- Float:churchz,
- c_enterable,
- bool:church_created,
- cpid,
- vehicle
- };
- new chInfo[MAX_CHURCH][E_SAMP_CHURCH];
- new churchID = 0,
- exitpoint = 1,
- churchVehicle = 0,
- exitPoint[MAX_CHURCH],
- misC[MAX_PLAYERS] = -1
- ;
- /*
- native CreateChurch(enterable = 0, interior = -1, world = -1, Float:cpsize = 2.0, Float:churchx, Float:churchy, Float:churchz, Float:churchdistance = 100.0);
- native SetChurchExit(churchid, interior = -1, world = -1, Float:cpsize = 2.0, Float:churchx, Float:churchy, Float:churchz, Float:churchdistance = 100.0);
- native SpawnChurchVehicle(vehicleid, Float:spawnx, Float:spawny, Float:spawnz, Float:spawnangle, color1, color2, spawndelay);
- native StartChurchMission(playerid, Float:mx, Float:my, Float:mz, Float:cpsize = 5.0);
- native NextChurchMission(playerid, Float:mx, Float:my, Float:mz, Float:cpsize = 5.0);
- native StopChurchMission(playerid);
- native SetChurchMission(playerid, mission);
- native GetChurchMission(playerid);
- native IsValidChurch(churchid);
- */
- stock SetChurchMission(playerid, mission)
- {
- if(mission == -1)
- {
- DisablePlayerCheckpoint(playerid);
- }
- misC[playerid] = mission;
- return 1;
- }
- stock GetChurchMission(playerid)
- {
- return misC[playerid];
- }
- stock StartChurchMission(playerid, Float:x, Float:y, Float:z, Float:size = 5.0)
- {
- misC[playerid] = 0;
- SetPlayerCheckpoint(playerid, x, y, z, size);
- return 1;
- }
- stock NextChurchMission(playerid, Float:x, Float:y, Float:z, Float:size = 5.0)
- {
- misC[playerid] += 1;
- DisablePlayerCheckpoint(playerid);
- SetPlayerCheckpoint(playerid, x, y, z, size);
- return 1;
- }
- stock SpawnChurchVehicle(vehicleid, Float:x, Float:y, Float:z, Float:angle, col1, col2, spawndelay)
- {
- churchVehicle++;
- chInfo[churchVehicle][vehicle] = AddStaticVehicleEx(vehicleid, x, y, z, angle, col1, col2, spawndelay);
- return churchVehicle;
- }
- stock SetChurchExit(&id, interior = -1, world = -1, Float:cpsize = 2.0, Float:x, Float:y, Float:z, Float:distance = 100.0)
- {
- exitpoint++;
- id = ( exitpoint );
- exitPoint[exitpoint] = CreateDynamicCP(x, y, z, cpsize, world, interior, -1, distance);
- return 1;
- }
- stock CreateChurch(enterable = 0, interior = -1, world = -1, Float:cpsize = 2.0, Float:x, Float:y, Float:z, Float:distance = 100.0)
- {
- churchID++;
- if(churchID > MAX_CHURCH)
- {
- print("Error: church.inc can't create church anymore!");
- return 1;
- }
- if(enterable < 0 || enterable > 1)
- {
- print("Error: enterbale parameters can only handle 0 and 1!");
- return 1;
- }
- chInfo[churchID][church_created] = true;
- chInfo[churchID][c_enterable] = enterable;
- chInfo[churchID][churchx] = x;
- chInfo[churchID][churchy] = y;
- chInfo[churchID][churchz] = z;
- chInfo[churchID][cpid] = CreateDynamicCP(x, y, z, cpsize, world, interior, -1, distance);
- return churchID;
- }
- stock IsValidChurch(churchid)
- {
- if(chInfo[churchid][church_created] == true)
- return true;
- else if(chInfo[churchid][church_created] == false)
- return false;
- return 0;
- }
- public OnPlayerEnterDynamicCP(playerid, checkpointid)
- {
- state _ALS_:hooked;
- for(new i = 0; i < MAX_CHURCH; i++)
- {
- if(!IsValidChurch(i)) continue;
- if(checkpointid == chInfo[i][cpid])
- {
- if(chInfo[i][c_enterable] == 0)
- {
- CallLocalFunction("OnPlayerEnterChurchMenu", "ii", playerid, checkpointid);
- continue;
- }
- else if(chInfo[i][c_enterable] == 1)
- {
- CallLocalFunction("OnPlayerEnterChurch", "ii", playerid, checkpointid);
- continue;
- }
- }
- }
- for(new a = 0; a < MAX_EPOINT; a++)
- {
- if(checkpointid == exitPoint[a])
- {
- CallLocalFunction("OnPlayerEnterCEPoint", "ii", playerid, checkpointid);
- continue;
- }
- }
- return church_OnPlayerEnterDynamicCP(playerid, checkpointid);
- }
- forward church_OnPlayerEnterDynamicCP(playerid, checkpointid);
- #if defined _ALS_OnPlayerEnterDynamicCP
- #undef OnPlayerEnterDynamicCP
- #else
- #define _ALS_OnPlayerEnterDynamicCP
- #endif
- public church_OnPlayerEnterDynamicCP(playerid, checkpointid) <_ALS_:unhooked> return 1;
- public church_OnPlayerEnterDynamicCP(playerid, checkpointid) <> return 1;
- #define OnPlayerEnterDynamicCP(%0) church_OnPlayerEnterDynamicCP(%0)<_ALS_:hooked>
- public OnPlayerLeaveDynamicCP(playerid, checkpointid)
- {
- state _ALS_:hooked;
- for(new i = 0; i < MAX_CHURCH; i++)
- {
- if(!IsValidChurch(i)) continue;
- if(checkpointid == chInfo[i][cpid])
- {
- if(chInfo[i][c_enterable] == 0)
- {
- CallLocalFunction("OnPlayerExitChurchMenu", "ii", playerid, checkpointid);
- continue;
- }
- }
- }
- return church_OnPlayerLeaveDynamicCP(playerid, checkpointid);
- }
- forward church_OnPlayerLeaveDynamicCP(playerid, checkpointid);
- #if defined _ALS_OnPlayerLeaveDynamicCP
- #undef OnPlayerLeaveDynamicCP
- #else
- #define _ALS_OnPlayerLeaveDynamicCP
- #endif
- public church_OnPlayerLeaveDynamicCP(playerid, checkpointid) <_ALS_:unhooked> return 1;
- public church_OnPlayerLeaveDynamicCP(playerid, checkpointid) <> return 1;
- #define OnPlayerLeaveDynamicCP(%0) church_OnPlayerLeaveDynamicCP(%0)<_ALS_:hooked>
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- state _ALS_:hooked;
- for(new i = 0; i < MAX_CHURCH; i++)
- {
- if(!IsValidChurch(i)) continue;
- if(vehicleid == chInfo[i][vehicle])
- {
- CallLocalFunction("OnPlayerEnterChurchVehicle", "iii", playerid, vehicleid, ispassenger);
- continue;
- }
- }
- return church_OnPlayerEnterVehicle(playerid, vehicleid, ispassenger);
- }
- forward church_OnPlayerEnterVehicle(playerid, vehicleid, ispassenger);
- #if defined _ALS_OnPlayerEnterVehicle
- #undef OnPlayerEnterVehicle
- #else
- #define _ALS_OnPlayerEnterVehicle
- #endif
- public church_OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) <_ALS_:unhooked> return 1;
- public church_OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) <> return 1;
- #define OnPlayerEnterVehicle(%0) church_OnPlayerEnterVehicle(%0)<_ALS_:hooked>
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- state _ALS_:hooked;
- for(new i = 0; i < MAX_CHURCH; i++)
- {
- if(!IsValidChurch(i)) continue;
- if(vehicleid == chInfo[i][vehicle])
- {
- CallLocalFunction("OnPlayerExitChurchVehicle", "ii", playerid, vehicleid);
- continue;
- }
- }
- return church_OnPlayerExitVehicle(playerid, vehicleid);
- }
- forward church_OnPlayerExitVehicle(playerid, vehicleid);
- #if defined _ALS_OnPlayerExitVehicle
- #undef OnPlayerExitVehicle
- #else
- #define _ALS_OnPlayerExitVehicle
- #endif
- public church_OnPlayerExitVehicle(playerid, vehicleid) <_ALS_:unhooked> return 1;
- public church_OnPlayerExitVehicle(playerid, vehicleid) <> return 1;
- #define OnPlayerExitVehicle(%0) church_OnPlayerExitVehicle(%0)<_ALS_:hooked>
- public OnPlayerEnterCheckpoint(playerid)
- {
- state _ALS_:hooked;
- if(misC[playerid] == 0)
- {
- CallLocalFunction("OnPlayerEnterChurchMission", "i", playerid);
- }
- else if(misC[playerid] >= 1)
- {
- CallLocalFunction("OnPlayerEnterChurchMissionEx", "i", playerid);
- }
- return church_OnPlayerEnterCheckpoint(playerid);
- }
- forward church_OnPlayerEnterCheckpoint(playerid);
- #if defined _ALS_OnPlayerEnterCheckpoint
- #undef OnPlayerEnterCheckpoint
- #else
- #define _ALS_OnPlayerEnterCheckpoint
- #endif
- public church_OnPlayerEnterCheckpoint(playerid) <_ALS_:unhooked> return 1;
- public church_OnPlayerEnterCheckpoint(playerid) <> return 1;
- #define OnPlayerEnterCheckpoint(%0) church_OnPlayerEnterCheckpoint(%0)<_ALS_:hooked>
Advertisement
Add Comment
Please, Sign In to add comment