Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #library "SEPAMMO"
- #include "zcommon.acs"
- int SA_CurrentTID = 0;
- int SA_CurrentTIDOld = 0;
- script "SA_Register" (void)
- {
- SA_CurrentTIDOld = ActivatorTID();
- SA_CurrentTID = UniqueTID();
- Thing_ChangeTID(0, SA_CurrentTID);
- }
- script "SA_Unregister" (void)
- {
- Thing_ChangeTID(0, SA_CurrentTIDOld);
- SA_CurrentTIDOld = 0;
- SA_CurrentTID = 0;
- }
- script "SA_Pickup" (void)
- {
- printbold(s:"pickup!");
- int tid = SA_CurrentTID;
- int playernum = PlayerNumber();
- bool pickedupalready;
- if (playernum > 31)
- {
- pickedupalready = !!(GetUserVariable(tid, "user_players2") & (1<<(playernum-32)));
- }
- else
- {
- pickedupalready = !!(GetUserVariable(tid, "user_players1") & (1<<(playernum)));
- }
- if (pickedupalready)
- terminate;
- str classnametogive = "";
- // I think strmid is 2.7.1. let's just do it manually for now.
- str classname = GetActorClass(tid);
- printbold(s:classname);
- if (GetChar(classname, 0) != 'S' ||
- GetChar(classname, 1) != 'A' ||
- GetChar(classname, 2) != '_') terminate;
- for (int i = 3; i < strlen(classname); i++)
- classnametogive = strparam(s:classnametogive, c:GetChar(classname, i));
- // remember that this player has picked up the item.
- if (playernum > 31)
- {
- SetUserVariable(tid, "user_players2", GetUserVariable(tid, "user_players2") | (1<<(playernum-32)));
- }
- else
- {
- SetUserVariable(tid, "user_players1", GetUserVariable(tid, "user_players1") | (1<<(playernum)));
- }
- // give the item.
- //
- print(s:"giving item to player ", d:playernum);
- }
Advertisement
Add Comment
Please, Sign In to add comment