Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // UHCPluginDemo.cpp : Defines the exported functions for the DLL application.
- //
- #include "stdafx.h"
- #include "UHCPlugin.h"
- #include <stdio.h>
- #include <stdlib.h>
- using namespace syscalls;
- // syscalls that returns a 'vector' uses the first parameter to return its value
- void vectorSyscallExample(vector ret) {
- kbGetMapCenter(ret);
- }
- void test(int player) {
- aiChat(player, "Hello World!");
- }
- // Turns a random enemy's settlers into sheep
- void __stdcall cheatExample(int) {
- xsSetContextPlayer(1);
- for (int i = 1; i < getNumberPlayers(); i++) {
- if (kbIsPlayerEnemy(i) && !kbIsPlayerResigned(i)) {
- xsSetContextPlayer(i);
- trUnitSelectClear();
- int unitQueryID = kbUnitQueryCreate("CheatUnitQuery");
- kbUnitQuerySetIgnoreKnockedOutUnits(unitQueryID, true);
- kbUnitQuerySetPlayerID(unitQueryID, i, true);
- kbUnitQuerySetUnitType(unitQueryID, kbGetProtoUnitID("Settler"));
- kbUnitQuerySetState(unitQueryID, cUnitStateAlive);
- kbUnitQueryResetResults(unitQueryID);
- int numberFound = kbUnitQueryExecute(unitQueryID);
- for (int n = 0; n < numberFound; n++)
- trUnitSelectByID(kbUnitQueryGetResult(unitQueryID, n));
- trUnitChangeProtoUnit("Sheep");
- //trSoundPlayFN("SheepSelect.wav", "", -1, "", "");
- break;
- }
- }
- }
- extern "C" _declspec(dllexport)
- int __stdcall UHCPluginMain(UHCPluginInfo* pluginInfo) {
- // Register your syscalls and cheats here...
- // After registering a syscall, it can be used in the 'scope' you defined.
- pluginInfo->SyscallRegister(pluginInfo->info, XS, Vector,
- "xsTest", vectorSyscallExample, 0, "xsTest: vector syscall example.");
- pluginInfo->SyscallRegister(pluginInfo->info, AI, Void,
- "aiTest", (void*)test, 1, "aiTest: Sends 'Hello World!' to specified player.");
- pluginInfo->SyscallSetParamInteger(pluginInfo->info, AI, 0, 1);
- pluginInfo->CheatRegister(pluginInfo->info, L"force of nature", true, cheatExample);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement