#include "vaultscript.h" #include <cstdio> using namespace std; using namespace vaultmp; Base nuka = (Base) 0x0001519E; Value area[] = {-12630.32, -15715.93, -12728.72, -15834.46}; IDSet player_nuka; Result VAULTSCRIPT NukaArea() noexcept { IDVector players = GetList(Type::ID_PLAYER); for (const ID& id : players) { if (!player_nuka.count(id) && GetActorSneaking(id)) { Value X, Y, Z; GetPos(id, X, Y, Z); if (X < area[0] && X > area[2] && Y < area[1] && Y > area[3]) { UIMessage(id, "You found a hidden nuka cola!"); AddItem(id, nuka, 1, 100.0, False); player_nuka.insert(id); } } } return (Result) 0; } Void VAULTSCRIPT exec() noexcept { if (GetGameCode() != Index::FALLOUT3) { printf("NukaScript is for Fallout 3 only!\n"); terminate(); } CreateTimer(&NukaArea, (Interval) 500); printf("NukaScript for Fallout 3 loaded\n"); } Void VAULTSCRIPT OnPlayerDisconnect(ID player, Reason reason) noexcept { player_nuka.erase(player); } Void VAULTSCRIPT OnSpawn(ID object) noexcept { player_nuka.erase(object); }
#include <vaultmp> #define MAX_PLAYERS (4) new PlayerID[MAX_PLAYERS] = [0,...]; new nuka = 0x0001519E, Float:area[] = [-12630.32,-15715.93,-12728.72,-15834.46], bool:event[MAX_PLAYERS] = [false,...]; main() { if(GetMaximumPlayers() > MAX_PLAYERS) printf("Error, your MAX_PLAYERS is too low! Required: %d",GetMaximumPlayers()); switch(GetGameCode()) { case FALLOUT3: { printf("NukaScript for Fallout 3loaded\n"); CreateTimer("NukaSpot",1000); } default: printf("NukaScript is for Fallout 3 only!\n"); } } public OnPlayerDisconnect(ID, reason) { new conID = GetConnection(ID); event[conID] = false; PlayerID[conID] = 0; } forward NukaSpot(); public NukaSpot() { for (new i; i<MAX_PLAYERS; i++) { new ID = PlayerID[i]; if(ID == 0 || event[i] || !GetActorSneaking(ID)) continue; new Float:x,Float:y,Float:z; GetPos(ID,x,y,z); if (x < area[0] && x > area[2] && y < area[1] && y > area[3]) { UIMessage(ID,"You found a hidden nuka cola!"); AddItem(ID,nuka,1,100.0,Bool:false); event[i] = true; } } return 1; }
Contributors: | ,
Created by Last edited by , 09-08-2012 at 05:43 PM 0 Comments, 3,985 Views |
, 04-28-2012 at 03:04 PM