Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define PLAYERMAX 64
- #define SCRIPTSLOTS 10
- #define SCRIPT_ACTIVE 0
- #define SCRIPT_NUMBER 1
- #define SCRIPT_ARG1 2
- #define SCRIPT_ARG2 3
- #define SCRIPT_ARG3 4
- int ScriptSignals[PLAYERMAX][SCRIPTSLOTS][5];
- /**
- * Send a script signal to the player given.
- * Returns: 0 if script is added properly, 1 if script is not added.
- **/
- function int SendSignal(int pln, int num, int arg1, int arg2, int arg3)
- {
- if (pln < 0 || pln >= PLAYERMAX) { return; }
- int i;
- for (i = 0; i < SCRIPTSLOTS; i++)
- {
- if (ScriptSignals[pln][i][SCRIPT_ACTIVE]) { continue; }
- ScriptSignals[pln][i][SCRIPT_ACTIVE] = 1;
- ScriptSignals[pln][i][SCRIPT_NUMBER] = num;
- ScriptSignals[pln][i][SCRIPT_ARG1] = arg1;
- ScriptSignals[pln][i][SCRIPT_ARG2] = arg2;
- ScriptSignals[pln][i][SCRIPT_ARG3] = arg3;
- return 0;
- }
- return 1;
- }
- /**
- * Clear the given signal.
- * Returns: nothing.
- **/
- function void ClearSignals(int pln, int slot)
- {
- if (pln < 0 || pln >= PLAYERMAX
- || slot < 0 || slot >= SCRIPTSLOTS) { return; }
- int i, j;
- for (i = 0; i < 5; i++)
- {
- ScriptSignals[pln][slot][j] = 0;
- }
- }
- /**
- * Process script signals and runs them.
- * Returns: nothing.
- **/
- function void CatchSignals(int pln)
- {
- __catchsignals__(pln, 0);
- }
- function void __catchsignals__(int pln, int noclear)
- {
- int i;
- int snum, arg1, arg2, arg3;
- for (i = 0; i < SCRIPTSLOTS; i++)
- {
- if (ScriptSignals[pln][i][SCRIPT_ACTIVE])
- {
- snum = ScriptSignals[pln][i][SCRIPT_NUMBER];
- arg1 = ScriptSignals[pln][i][SCRIPT_ARG1];
- arg2 = ScriptSignals[pln][i][SCRIPT_ARG2];
- arg3 = ScriptSignals[pln][i][SCRIPT_ARG3];
- ACS_ExecuteWithResult(snum, arg1, arg2, arg3);
- }
- if (!noclear) { ClearSignal(pln, i); }
- }
- }
- script 723 enter
- {
- int pln = PlayerNumber();
- int i;
- for (i = 0; i < SCRIPTSLOTS; i++) { ClearSignal(pln, i); }
- while (!(ClassifyActor(0) & ACTOR_WORLD))
- {
- CatchSignals(pln);
- Delay(1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement