Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This code is from the Survivalism WAD -- Hax Murderer
- function void restorePersistentInventory (int playerTid)
- {
- if (!PlayerIsLoggedIn(PlayerNumber()))
- {
- Log(s:"If you were logged in, we would be restoring your inventory!");
- return;
- }
- str accountName = GetPlayerAccountName(PlayerNumber());
- str namespace = strparam(s:accountName, s:"_inventory");
- print(s:"Restoring your inventory...", s:namespace);
- for (int i = 0; i < PERSISTENT_INVENTORY_LEN; i++) {
- GiveActorInventory(playerTid, persistentInventory[i], GetDBEntry(namespace, persistentInventory[i]));
- }
- print(s:"Inventory restored!");
- }
- script 810 /*savePersistentInventory*/ (void)
- {
- int playerTid = PLAYER_MIN_TID + PlayerNumber();
- if (!PlayerIsLoggedIn(PlayerNumber()))
- {
- print(s:"You must be logged in save your inventory.");
- ActivatorSound("menu/invalid", 127);
- terminate;
- }
- str accountName = GetPlayerAccountName(PlayerNumber());
- str namespace = strparam(s:accountName, s:"_inventory");
- print(s:"Saving your inventory...");
- BeginDBTransaction();
- for (int i = 0; i < PERSISTENT_INVENTORY_LEN; i++) {
- SetDBEntry(namespace, persistentInventory[i], CheckActorInventory(playerTid, persistentInventory[i]));
- //print(s:persistentInventory[i], s:" amount:", d:CheckActorInventory(playerTid, persistentInventory[i]));
- }
- EndDBTransaction();
- print(s:"Inventory saved!");
- ActivatorSound("switches/normbutn", 127);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement