Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #library "opppacs"
- #include "zcommon.acs"
- #libdefine OPPP_spawn 860 /* item spawning script */
- #libdefine OPPP_pickup 861 /* pickup script */
- #libdefine OPPP_vis 862 /* clientside script to make pickup visible or invisible */
- /* string array of all classes for spawning */
- str pickup_class[40] = { "Backpack_Pickup", "Cell_Pickup", "CellPack_Pickup", "Clip_Pickup", "ClipBox_Pickup", "RocketAmmo_Pickup", "RocketBox_Pickup", "Shell_Pickup", "ShellBox_Pickup", "BFG9000_Pickup",
- "Chaingun_Pickup", "Chainsaw_Pickup", "Pistol_Pickup", "PlasmaRifle_Pickup", "RocketLauncher_Pickup", "Shotgun_Pickup", "SuperShotgun_Pickup", "Berserk_Pickup", "HealthBonus_Pickup", "Medikit_Pickup",
- "Megasphere_Pickup", "Soulsphere_Pickup", "Stimpack_Pickup", "ArmorBonus_Pickup", "BlueArmor_Pickup", "GreenArmor_Pickup", "Allmap_Pickup", "BlurSphere_Pickup", "Infrared_Pickup", "InvulnerabilitySphere_Pickup",
- "RadSuit_Pickup", "NULL", "NULL", "NULL", "NULL", "NULL", "NULL", "NULL", "NULL", "NULL" };
- /* string array of suffixes for classes for spawning */
- str pickup_num[64] = { "_00", "_01", "_02", "_03", "_04", "_05", "_06", "_07", "_08", "_09",
- "_10", "_11", "_12", "_13", "_14", "_15", "_16", "_17", "_18", "_19",
- "_20", "_21", "_22", "_23", "_24", "_25", "_26", "_27", "_28", "_29",
- "_30", "_31", "_32", "_33", "_34", "_35", "_36", "_37", "_38", "_39",
- "_40", "_41", "_42", "_43", "_44", "_45", "_46", "_47", "_48", "_49",
- "_50", "_51", "_52", "_53", "_54", "_55", "_56", "_57", "_58", "_59",
- "_60", "_61", "_62", "_63" };
- script OPPP_spawn (int class) /* class of item to spawn */
- {
- int var, tid, i; /* user array, unique tid, loop variable */
- int a_x, a_y, a_z; /* activator x, y, and z position */
- str con_class; /* constructed class to spawn */
- a_x = GetActorX(0); /* get activator x position */
- a_y = GetActorY(0); /* get activator z position */
- a_z = GetActorZ(0); /* get activator x position */
- for(i = 0; i < 64; ++i){ /* for all player numbers, 0 - 63 */
- if(PlayerInGame(i) && /* if player i is in game AND */
- !GetUserArray(0, "user_player", i)){ /* spawner has NOT already spawned item for player i */
- tid = UniqueTID(); /* get a new unique tid */
- con_class = strparam(s:pickup_class[class], s:pickup_num[i]); /* construct class to spawn */
- /* spawn an actor of the specified class at the activator position with new tid */
- SpawnForced(con_class, a_x, a_y, a_z, tid);
- SetUserArray(0, "user_player", i, 1); }} /* mark in activator user array that item has been spawned for i player */
- /* log(s:"class: ", s:con_class, s:" array value: ", i:GetUserArray(0, "user_player", i)); */
- }
- /* script to determine whether item will be picked up */
- script OPPP_pickup (int player) /* the player that pick up is intended for, passed to script */
- {
- int player_num, result; /* the player number of player trying to pick up item, result variable */
- result = 0; /* this should already be 0, but who the fuck knows */
- player_num = PlayerNumber(); /* get the number of the activating player */
- /* log(s:"player: ", i:player, s:" player_num: ", i:player_num); /* debug log */
- if(player_num == player){ /* if the player number matches the intended player pickup, sent via decorate */
- result = 1; }/* set result to one */
- SetResultValue(result); /* return result */
- }
- script OPPP_vis (void) CLIENTSIDE
- {
- int player_con, damage; /* the number of the local player, the damage property being hackily used as player number arg */
- player_con = ConsolePlayerNumber(); /* get the number of the local player */
- damage = GetActorProperty(0, APROP_Damage); /* get the damage property being hackily used as player number arg */
- /* log(s:"damage: ", i:damage, s:" player_con: ", i:player_con); */
- if(player_con > -1){ /* make sure this is not being executed on the server */
- if(player_con == damage){ /* if the player number arg is the same as local player number */
- SetActorState(0,"CanSee"); /* set the actor to the visible state */
- terminate; }} /* terminate the script */
- SetActorState(0,"NoSee"); /* otherwise (default) set the actor to the invisible state */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement