Created
May 17, 2014 01:30
-
-
Save Whitetigerswt/5c5e3361efac34c09935 to your computer and use it in GitHub Desktop.
YSF windows server independance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "main.h" | |
#include "Addresses.h" | |
#ifdef _WIN32 | |
DWORD CAddress::FUNC_Logprintf_03Z = 0x00486CB0; | |
DWORD CAddress::FUNC_Logprintf_03ZR2_2 = 0x00487310; | |
#else | |
DWORD CAddress::FUNC_Logprintf_03Z = 0x080A7440; | |
DWORD CAddress::FUNC_Logprintf_03ZR2_2 = 0x080A77D0; | |
#endif | |
// Pointers | |
DWORD CAddress::VAR_ppNetGame = NULL; | |
DWORD CAddress::VAR_ppConsole = NULL; | |
DWORD CAddress::VAR_ppRakServer = NULL; | |
// Variables | |
DWORD CAddress::VAR_pRestartWaitTime = NULL; | |
// Functions | |
DWORD CAddress::FUNC_CConsole_AddStringVariable = NULL; | |
DWORD CAddress::FUNC_CConsole_SetStringVariable = NULL; | |
DWORD CAddress::FUNC_CConsole_ModifyVariableFlags = NULL; | |
DWORD CAddress::FUNC_CFilterscripts_LoadFilterscript = NULL; | |
DWORD CAddress::FUNC_CFilterscripts_UnLoadFilterscript = NULL; | |
void CAddress::Initialize(eSAMPVersion sampVersion) | |
{ | |
#ifdef WIN32 | |
VAR_pRestartWaitTime = FindPattern("\x00\x00\xC8\xC2\x00\x00", "xxxxxx") + 0x4; | |
FUNC_CConsole_AddStringVariable = FindPattern("\x53\x56\x57\x8B\x7C\x24\x18\x85\xFF", "xxxxxxxxx"); | |
FUNC_CConsole_SetStringVariable = FindPattern("\x8B\x44\x24\x04\x53\x50\xE8\xD5\xFE\xFF\xFF\x8B\xD8\x85\xDB", "xxxxxxx???xxxx"); | |
FUNC_CConsole_ModifyVariableFlags = FindPattern("\x8B\x44\x24\x04\x50\xE8\x16\xFF\xFF\xFF\x85\xC0\x74\x07", "xxxxxx????xxxx"); | |
FUNC_CFilterscripts_LoadFilterscript = FindPattern("\x8B\x44\x24\x04\x81\xEC\x04\x01\x00\x00", "xxxxxxxxxx"); | |
FUNC_CFilterscripts_UnLoadFilterscript = FindPattern("\xCC\x51\x53\x8B\x5C\x24\x0C\x55\x56\x57\x89", "xxxxxxxxxxx") + 0x1; | |
#else | |
switch(sampVersion) | |
{ | |
case SAMP_VERSION_03Z: | |
VAR_pRestartWaitTime = 0x8150130; | |
FUNC_CConsole_AddStringVariable = 0x0809F590; | |
FUNC_CConsole_SetStringVariable = 0x0809EDB0; | |
FUNC_CConsole_ModifyVariableFlags = 0x0809EE60; | |
FUNC_CFilterscripts_LoadFilterscript = 0x0809FDB0; | |
FUNC_CFilterscripts_UnLoadFilterscript = 0x080A01E0; | |
} | |
case SAMP_VERSION_03Z_R2_2: | |
{ | |
VAR_pRestartWaitTime = 0x8150B60; | |
FUNC_CConsole_AddStringVariable = 0x809F760; | |
FUNC_CConsole_SetStringVariable = 0x809F000; | |
FUNC_CConsole_ModifyVariableFlags = 0x809F030; | |
FUNC_CFilterscripts_LoadFilterscript = 0x0809FF80; | |
FUNC_CFilterscripts_UnLoadFilterscript = 0x080A03B0; | |
} | |
} | |
#endif | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//---------------------------------------------------------- | |
// | |
// SA:MP Multiplayer Modification For GTA:SA | |
// Copyright 2004-2007 SA:MP Team | |
// | |
//---------------------------------------------------------- | |
#include "main.h" | |
#ifdef SAJAT_HASZNALAT | |
#include "CHouseManager.h" | |
#endif | |
#include <fstream> | |
#include "SDK/amx/amx.h" | |
#include "SDK/plugincommon.h" | |
#ifdef LINUX | |
#include <cstring> | |
typedef unsigned char *PCHAR; | |
#endif | |
//---------------------------------------------------------- | |
#define YSI_VERSION_MAJOR 1 | |
#define YSI_VERSION_MINOR 4 | |
#define YSI_VERSION_FEAT 1 | |
logprintf_t logprintf; | |
void **ppPluginData; | |
extern void *pAMXFunctions; | |
CServer *pServer; | |
CPlayerData *pPlayerData[MAX_PLAYERS]; | |
RakServer *pRakServer = NULL; | |
//class CHouseManager; | |
#ifdef SAJAT_HASZNALAT | |
CHouseManager *pHouseManger = NULL; | |
#endif | |
void *pConsole; | |
void **p_SomeInfo; | |
void SetModeRestartTime(float time); | |
void SetServerRule(char *rule, char *value); | |
//void RemoveServerRule(char *rule); | |
void ModifyFlag(char *rule, int varflag); | |
char * GetServerRule(char *rule); | |
void InstallPreHooks(); | |
void InstallPostHooks(); | |
CSAMPServer *pNetGame = NULL; | |
std::list<AMX*> pAMXList; | |
//---------------------------------------------------------- | |
// The Support() function indicates what possibilities this | |
// plugin has. The SUPPORTS_VERSION flag is required to check | |
// for compatibility with the server. | |
PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports() | |
{ | |
return SUPPORTS_VERSION | SUPPORTS_AMX_NATIVES | SUPPORTS_PROCESS_TICK; | |
} | |
//---------------------------------------------------------- | |
// The Load() function gets passed on exported functions from | |
// the SA-MP Server, like the AMX Functions and logprintf(). | |
// Should return true if loading the plugin has succeeded. | |
void *InternalNetGame = NULL; | |
void *InternalConsole = NULL; | |
void *InternalRakServer = NULL; | |
void *InternalUnloadFS = NULL; | |
PLUGIN_EXPORT bool PLUGIN_CALL Load(void ** ppData) | |
{ | |
pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS]; | |
logprintf = (logprintf_t)ppData[PLUGIN_DATA_LOGPRINTF]; | |
logprintf("logprintf = 0x%08X\n", (int)logprintf); | |
// Store internal pointers | |
InternalNetGame = ppData[225]; | |
InternalConsole = ppData[228]; | |
InternalRakServer = ppData[226]; | |
InternalUnloadFS = ppData[229]; | |
// Check server version | |
eSAMPVersion version = SAMP_VERSION_UNKNOWN; | |
char szVersion[16]; | |
if(logprintf == (logprintf_t)CAddress::FUNC_Logprintf_03Z) | |
{ | |
version = SAMP_VERSION_03Z; | |
strcpy(szVersion, "0.3z"); | |
} | |
else if(logprintf == (logprintf_t)CAddress::FUNC_Logprintf_03ZR2_2) | |
{ | |
version = SAMP_VERSION_03Z_R2_2; | |
strcpy(szVersion, "0.3z R2-2"); | |
} | |
// If not unknown, then initalize things | |
if(version != SAMP_VERSION_UNKNOWN) | |
{ | |
CAddress::Initialize(version); | |
// Create server instance with default SA-MP pointers | |
pServer = new CServer(); | |
#ifdef SAJAT_HASZNALAT | |
pHouseManger = new CHouseManager(); | |
logprintf("CHouseManager létrehozva"); | |
/* | |
pHouseManger->AddHouse(3); | |
for(int i = 0; i != 500; i++) | |
{ | |
houselement_t *element = new houselement_t; | |
element->modelid = 1000 + i; | |
element->vecPos = CVector(12.0 + i, 13.0, 14.0); | |
element->vecRot = CVector(15.0 + i * 2, 16.0, 17.0); | |
element->unixtime = 452452; | |
pHouseManger->AddHouseElement(3, i, element); | |
delete element; | |
houselement_t *pElement = pHouseManger->GetHouseElement(3, i); | |
if(pElement) | |
logprintf("modelid: %d, %f, %f, %f - unixtime: %d", pElement->modelid, pElement->vecPos.fX, pElement->vecPos.fY, pElement->vecPos.fZ, pElement->unixtime); | |
} | |
//pHouseManger->LoadHouses(); | |
pHouseManger->SaveHouseData(3); | |
*/ | |
#endif | |
} | |
else | |
{ | |
logprintf("Error: Unknown " OS_NAME " server version\n"); | |
return true; | |
} | |
InstallPreHooks(); | |
logprintf("\n"); | |
logprintf(" ===============================\n"); | |
logprintf(" " PROJECT_NAME " - kurta999 version " PROJECT_VERSION " loaded\n"); | |
logprintf(" (c) 2008 Alex \"Y_Less\" Cole - (c) 2010 - 2014 kurta999\n"); | |
logprintf(" Server version: %s\n", szVersion); | |
logprintf(" Operating System: " OS_NAME "\n"); | |
logprintf(" Built on: " __DATE__ " at "__TIME__ "\n"); | |
logprintf(" ===============================\n"); | |
return true; | |
} | |
//---------------------------------------------------------- | |
// The Unload() function is called when the server shuts down, | |
// meaning this plugin gets shut down with it. | |
PLUGIN_EXPORT void PLUGIN_CALL Unload() | |
{ | |
// Corrected apperance in log file | |
logprintf("\n"); | |
logprintf(" ==============\n"); | |
logprintf(" %s unloaded\n", PROJECT_NAME); | |
logprintf(" =============="); | |
delete pServer; | |
pServer = NULL; | |
#ifdef SAJAT_HASZNALAT | |
delete pHouseManger; | |
pHouseManger = NULL; | |
#endif | |
} | |
//---------------------------------------------------------- | |
// The AmxLoad() function gets called when a new gamemode or | |
// filterscript gets loaded with the server. In here we register | |
// the native functions we like to add to the scripts. | |
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad(AMX * amx) | |
{ | |
if(!pServer) | |
goto Ide; | |
// Add AMX instance to our amxlist | |
pAMXList.push_back(amx); | |
logprintf("AMXLoad1"); | |
static bool | |
bFirst = false; | |
if(!bFirst) | |
{ | |
// pNetGame initializálása | |
//pNetGame = *(CSAMPServer**)CAddress::VAR_ppNetGame; | |
//pConsole = *(void**)CAddress::VAR_ppConsole; | |
//pRakServer = *(RakServer**)CAddress::VAR_ppRakServer; | |
bFirst = true; | |
logprintf("AMXLoad2"); | |
// Get pNetGame | |
int (*pfn_GetNetGame)(void) = (int (*)(void))InternalNetGame; | |
pNetGame = (CSAMPServer*)pfn_GetNetGame(); | |
// Get pConsole | |
int (*pfn_GetConsole)(void) = (int (*)(void))InternalConsole; | |
pConsole = (void*)pfn_GetConsole(); | |
// Get pRakServer | |
int (*pfn_GetRakServer)(void) = (int (*)(void))InternalRakServer; | |
pRakServer = (RakServer*)pfn_GetRakServer(); | |
//logprintf("unloadfs: %x", InternalUnloadFS); | |
logprintf("AMXLoad3 pRakServer: %x, pNetGame: %x", pRakServer, pNetGame); | |
//printf("pNetGame: 0x%X\n", pNetGame); | |
logprintf("AMXLoad4"); | |
} | |
else | |
{ | |
if(pNetGame->pPlayerPool->bIsPlayerConnected[4]) | |
{ | |
CSAMPPlayer *pPlayer = pNetGame->pPlayerPool->pPlayer[4]; | |
//logprintf("3dtext exists: %d, text: %s", pPlayer->p3DText->isCreated[1], pPlayer->p3DText->TextLabels[1].text); | |
/* | |
logprintf("td: %d, pos: %f, text: %s", pPlayer->pTextdraw->m_bSlotState[1], pPlayer->pTextdraw->m_TextDraw[1]->fX, pPlayer->pTextdraw->m_szFontText[1]); | |
logprintf("ispresent: %d", pPlayer->pTextdraw->m_bHasText[1]); | |
logprintf("vec: %f, %f, %f", pPlayer->vecBulletStart.fX, pPlayer->vecBulletStart.fY, pPlayer->vecBulletStart.fZ); | |
logprintf("fcp: %f, %f, %f, %f", pPlayer->vecCPPos.fX, pPlayer->vecCPPos.fY, pPlayer->vecCPPos.fZ, pPlayer->fCPSize); | |
logprintf("fracecp: %f, %f, %f - %f, %f, %f - size: %f, type: %d", pPlayer->vecRaceCPPos.fX, pPlayer->vecRaceCPPos.fY, pPlayer->vecRaceCPPos.fZ, | |
pPlayer->vecRaceCPNextPos.fX, pPlayer->vecRaceCPNextPos.fY, pPlayer->vecRaceCPNextPos.fZ, pPlayer->fRaceCPSize, pPlayer->byteRaceCPType); | |
logprintf("bInModShop: %d - %d", pPlayer->bIsInModShop, pPlayer->vmifasssag); | |
*/ | |
} | |
/* | |
CMenu *pMenu = pNetGame->pMenuPool->menu[1]; | |
logprintf("menu: %d", pNetGame->pMenuPool->isCreated[1]); | |
logprintf("wid: %f, %f, colums: %d, headers: %s, %s", pMenu->column1Width, pMenu->column2Width, pMenu->columnsNumber, pMenu->headers[0], pMenu->headers[1]); | |
logprintf("item: %s, count: %d, pos: %f, %f, title: %s", pMenu->items[0][1], pMenu->itemsCount[0], pMenu->posX, pMenu->posY, pMenu->title); | |
for(int i = 0; i != 1024; i++) | |
{ | |
if(!pNetGame->p3DTextPool->m_bIsCreated[i]) continue; | |
Text3DLabels_t pText = pNetGame->p3DTextPool->m_TextLabels[i]; | |
logprintf("created %d", i); | |
logprintf("text: %s", pText.text); | |
logprintf("pos: %f, %f, %f, color: %d, drawdistance: %f, los: %d, attach: %d, %d", pText.posX, pText.posY, pText.posZ, pText.color, pText.drawDistance, pText.useLineOfSight, pText.attachedToPlayerID, pText.attachedToVehicleID); | |
} | |
*/ | |
/* | |
for(int i = 0; i != 1024; i++) | |
{ | |
if(!pNetGame->pTextDrawPool->m_bSlotState[i]) continue; | |
CTextdraw *pTD = pNetGame->pTextDrawPool->m_TextDraw[i]; | |
logprintf("td: %d, str: %s, pos: %f, %f", i, pNetGame->pTextDrawPool->m_szFontText[i], pTD->fX, pTD->fY); | |
logprintf("", pTD->byteBox | |
} | |
*/ | |
/* | |
for(int i = 0; i != 1000; i++) | |
{ | |
if(!pNetGame->pObjectPool->m_bObjectSlotState[i]) continue; | |
CObject *object = pNetGame->pObjectPool->m_pObjects[i]; | |
logprintf("txd: %s, texture: %s, something: %d, %d, vmigeci: %d", object->szTXDName, object->szTextureName, object->something1, object->something2, object->vmigeci); | |
//for(int x = 0; x != 6; x++) | |
//logprintf("mat %d - %X", x, object->paddin__g[x]); | |
} | |
*/ | |
/* | |
if(pNetGame->pVehiclePool->pVehicle[500]) | |
{ | |
CSAMPVehicle *pVeh = pNetGame->pVehiclePool->pVehicle[500]; | |
logprintf("col: %d, %d, int: %d, respawn: %d", pNetGame->pVehiclePool->pVehicle[500]->color1, pNetGame->pVehiclePool->pVehicle[500]->color2, pNetGame->pVehiclePool->pVehicle[500]->interior, pNetGame->pVehiclePool->pVehicle[500]->respawndelay); | |
logprintf("spawn: %f, %f, %f", pNetGame->pVehiclePool->pVehicle[500]->vecSpawnPos.fX, pNetGame->pVehiclePool->pVehicle[500]->vecSpawnPos.fY, pNetGame->pVehiclePool->pVehicle[500]->vecSpawnPos.fZ); | |
logprintf("plate: %s, occ: %d, respawn: %d, lastdriver: %d", pVeh->szNumberplate, pVeh->vehOccupiedTick, pVeh->vehRespawnTick, pVeh->usLastDriverID); | |
/* | |
for(int i = 0; i != 42; i++) | |
logprintf("plate %d: %d", i, pVeh->pad1[i]); | |
if(pNetGame->pPlayerPool->bIsPlayerConnected[4]) | |
{ | |
CSAMPPlayer *pPlayer = pNetGame->pPlayerPool->pPlayer[4]; | |
logprintf("model: %d, bone: %d, %f, %f, %f, materialcolor: %d, %d, slotstate: %d", pPlayer->attachedObject[0].iModelID, pPlayer->attachedObject[0].iBoneiD, pPlayer->attachedObject[0].vecPos.fX, pPlayer->attachedObject[0].vecPos.fY, pPlayer->attachedObject[0].vecPos.fZ, pPlayer->attachedObject[0].dwMaterialColor1, pPlayer->attachedObject[0].dwMaterialColor2, pPlayer->attachedObjectSlot[0]); | |
//logprintf("pos: %f, %f, %f, %f", pNetGame->pPlayerPool->pPlayer[4]->vecCPPos.fX, pNetGame->pPlayerPool->pPlayer[4]->vecCPPos.fY, pNetGame->pPlayerPool->pPlayer[4]->vecCPPos.fZ, pNetGame->pPlayerPool->pPlayer[4]->fCPSize); | |
logprintf("quat: %f, %f, %f, %f", pPlayer->fQuaternion[0], pPlayer->fQuaternion[1], pPlayer->fQuaternion[2], pPlayer->fQuaternion[3]); | |
} | |
for(int i = 0; i != 11; i++) | |
{ | |
logprintf("skillevel %d - %d", i, pNetGame->pPlayerPool->pPlayer[4]->wSkillLevel[i]); | |
} | |
*/ | |
/* | |
for(int i = 0; i != 1024; i++) | |
{ | |
if(!pNetGame->pPickupPool->m_bActive[i]) continue; | |
logprintf("ppos %d - %f, %f, %f", i, pNetGame->pPickupPool->m_Pickup[i].vecPos.fX, pNetGame->pPickupPool->m_Pickup[i].position.fY, pNetGame->pPickupPool->m_Pickup[i].position.fZ); | |
} | |
*/ | |
/* | |
for(int i = 0; i != 1000; i++) | |
{ | |
if(!pNetGame->pObjectPool->m_bObjectSlotState[i]) continue; | |
CObject *object = pNetGame->pObjectPool->m_pObjects[i]; | |
logprintf("pos %d: %d - %f, %f, %f, movespeed: NA", i, pNetGame->pObjectPool->m_pObjects[i]->m_iModel, pNetGame->pObjectPool->m_pObjects[i]->m_vecPos.fX, pNetGame->pObjectPool->m_pObjects[i]->m_vecPos.fY, pNetGame->pObjectPool->m_pObjects[i]->m_vecPos.fZ); | |
logprintf("drawdistance: %f - %f, %f, %f", object->m_fDrawDistance, pNetGame->pObjectPool->m_pObjects[i]->m_vecRot.fX, pNetGame->pObjectPool->m_pObjects[i]->m_vecRot.fY, pNetGame->pObjectPool->m_pObjects[i]->m_vecRot.fZ); | |
//logprintf("geci: %f, %d, %d", pNetGame->pObjectPool->m_pObjects[i]->m_fDrawDistance, pNetGame->pObjectPool->m_pObjects[i]->m_usAttachedVehicleID, pNetGame->pObjectPool->m_pObjects[i]->m_usAttachedObjectID); | |
logprintf("attached: %d, %d", object->m_usAttachedVehicleID, object->m_usAttachedObjectID); | |
logprintf("offset: %f, %f, %f, %f, %f, %f", object->m_vecAttachedOffset.fX, object->m_vecAttachedOffset.fY, object->m_vecAttachedOffset.fZ, object->m_vecAttachedRotation.fX, object->m_vecAttachedRotation.fY, object->m_vecAttachedRotation.fZ); | |
logprintf("ismoving: %d, %f, %f, %f, %f, %f", object->m_bIsMoving, object->unk1, object->unk2, object->unk3, object->unk4); | |
} | |
logprintf("spawnpos: %f", pNetGame->pPlayerPool->pPlayer[0]->vecSpawnPosition.fX); | |
} | |
*/ | |
} | |
Ide: | |
return InitScripting(amx); | |
} | |
//---------------------------------------------------------- | |
// When a gamemode is over or a filterscript gets unloaded, this | |
// function gets called. No special actions needed in here. | |
PLUGIN_EXPORT int PLUGIN_CALL AmxUnload(AMX * amx) | |
{ | |
// Remove AMX instance from our amxlist | |
pAMXList.remove(amx); | |
return AMX_ERR_NONE; | |
} | |
BYTE g_Ticks = 0; | |
PLUGIN_EXPORT void PLUGIN_CALL ProcessTick() | |
{ | |
if(++g_Ticks == 5) | |
{ | |
//logprintf("process"); | |
g_Ticks = 0; | |
for(int playerid = 0; playerid != MAX_PLAYERS; playerid++) | |
{ | |
if(!pPlayerData[playerid]) continue; | |
/* | |
CSAMPPlayer *pPlayer = pNetGame->pPlayerPool->pPlayer[4]; | |
if(pPlayer) | |
{ | |
//logprintf("siren: %d, gearstate: %d, trailer: %d, trainspeed: %f, hydrareactor: %d, %d", pPlayer->vehicleSyncData.byteSirenState, pPlayer->vehicleSyncData.byteGearState, pPlayer->vehicleSyncData.wTrailerID, | |
//pPlayer->vehicleSyncData.fTrainSpeed, pPlayer->vehicleSyncData.wHydraReactorAngle[0], pPlayer->vehicleSyncData.wHydraReactorAngle[1]); | |
//logprintf("surfinginfo: %d, %f, %f, %f", pPlayer->syncData.wSurfingInfo, pPlayer->syncData.vecSurfing.fX, pPlayer->syncData.vecSurfing.fY, pPlayer->syncData.vecSurfing.fZ); | |
} | |
*/ | |
for(int zoneid = 0; zoneid != MAX_GANG_ZONES; zoneid++) | |
{ | |
if(!pPlayerData[playerid]->bGangZonePresent[zoneid]) continue; | |
// Mutatók létrehozása | |
CVector *vecPos = &pNetGame->pPlayerPool->pPlayer[playerid]->vecPosition; | |
float *fMinX = &pNetGame->pGangZonePool->m_fGangZone[zoneid][0]; | |
float *fMinY = &pNetGame->pGangZonePool->m_fGangZone[zoneid][1]; | |
float *fMaxX = &pNetGame->pGangZonePool->m_fGangZone[zoneid][2]; | |
float *fMaxY = &pNetGame->pGangZonePool->m_fGangZone[zoneid][3]; | |
// Ha benne van | |
if(vecPos->fX >= *fMinX && vecPos->fX <= *fMaxX && vecPos->fY >= *fMinY && vecPos->fY <= *fMaxY && !pPlayerData[playerid]->bInGangZone[zoneid]) | |
{ | |
pPlayerData[playerid]->bInGangZone[zoneid] = true; | |
//logprintf("enterzone: %d", zoneid); | |
// Call callback | |
int idx = -1; | |
std::list<AMX*>::iterator second; | |
for(second = pAMXList.begin(); second != pAMXList.end(); ++second) | |
{ | |
if(!amx_FindPublic(*second, "OnPlayerEnterGangZone", &idx)) | |
{ | |
cell | |
ret; | |
amx_Push(*second, zoneid); | |
amx_Push(*second, playerid); | |
amx_Exec(*second, &ret, idx); | |
} | |
} | |
// amx call | |
} | |
else if(!(vecPos->fX >= *fMinX && vecPos->fX <= *fMaxX && vecPos->fY >= *fMinY && vecPos->fY <= *fMaxY) && pPlayerData[playerid]->bInGangZone[zoneid]) | |
{ | |
pPlayerData[playerid]->bInGangZone[zoneid] = false; | |
//logprintf("leavezone: %d", zoneid); | |
// Call callback | |
int idx = -1; | |
std::list<AMX*>::iterator second; | |
for(second = pAMXList.begin(); second != pAMXList.end(); ++second) | |
{ | |
if(!amx_FindPublic(*second, "OnPlayerLeaveGangZone", &idx)) | |
{ | |
cell | |
ret; | |
amx_Push(*second, zoneid); | |
amx_Push(*second, playerid); | |
amx_Exec(*second, &ret, idx); | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __YSF_MAINH | |
#define __YSF_MAINH | |
//#define SAJAT_HASZNALAT | |
#include <stdio.h> | |
#include <vector> | |
#include <list> | |
#include <iostream> | |
#include <stdlib.h> | |
// Includes | |
#include "Addresses.h" | |
#include "CPlayer.h" | |
#include "CServer.h" | |
#include "CVector.h" | |
#include "Inlines.h" | |
#include "RPCs.h" | |
#include "Scripting.h" | |
#include "PatternScan.h" | |
#ifdef SAJAT_HASZNALAT | |
#include "CHouseManager.h" | |
#endif | |
#include "CModelSizes.h" | |
#define MAX_HOUSES 300 | |
#define MAX_HOUSE_ELEMENTS 500 | |
class CSAMPServer; | |
extern CSAMPServer *pNetGame; | |
extern CServer *pServer; | |
extern CPlayerData *pPlayerData[MAX_PLAYERS]; | |
extern RakServer *pRakServer; | |
extern void* InternalUnloadFS; | |
#ifdef SAJAT_HASZNALAT | |
class CHouseManager; | |
extern CHouseManager *pHouseManger; | |
#endif | |
typedef void (* logprintf_t)(char *, ...); | |
extern logprintf_t logprintf; | |
extern std::list<AMX*> pAMXList; | |
typedef unsigned short PLAYERID; | |
#define SERVER_VERSION_0303 (0x0303) | |
#define SERVER_VERSION_0304 (0x0304) | |
#define SERVER_VERSION_0341 (0x0341) | |
#ifdef LINUX | |
typedef unsigned long DWORD; | |
typedef int BOOL; | |
typedef unsigned char BYTE; | |
typedef unsigned short WORD; | |
typedef float FLOAT; | |
typedef int INT; | |
typedef unsigned int UINT; | |
#endif | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "main.h" | |
#ifdef WIN32 | |
#include <Psapi.h> | |
#else | |
#endif | |
DWORD FindPattern(char *pattern, char *mask) | |
{ | |
#ifdef WIN32 | |
MODULEINFO mInfo = {0}; | |
GetModuleInformation(GetCurrentProcess(), GetModuleHandle(NULL), &mInfo, sizeof(MODULEINFO)); | |
DWORD base = (DWORD)mInfo.lpBaseOfDll; | |
DWORD size = (DWORD)mInfo.SizeOfImage; | |
#else | |
#endif | |
DWORD patternLength = (DWORD)strlen(mask); | |
for(DWORD i = 0; i < size - patternLength; i++) | |
{ | |
bool found = true; | |
for(DWORD j = 0; j < patternLength; j++) | |
{ | |
found &= mask[j] == '?' || pattern[j] == *(char*)(base + i + j); | |
} | |
if(found) | |
{ | |
return base + i; | |
} | |
} | |
return NULL; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DWORD FindPattern(char *pattern, char *mask); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<ItemGroup Label="ProjectConfigurations"> | |
<ProjectConfiguration Include="Debug|Win32"> | |
<Configuration>Debug</Configuration> | |
<Platform>Win32</Platform> | |
</ProjectConfiguration> | |
<ProjectConfiguration Include="Release|Win32"> | |
<Configuration>Release</Configuration> | |
<Platform>Win32</Platform> | |
</ProjectConfiguration> | |
</ItemGroup> | |
<PropertyGroup Label="Globals"> | |
<ProjectGuid>{224A61C2-BACD-40C4-8670-EA295C14C1ED}</ProjectGuid> | |
<RootNamespace>HelloWorld</RootNamespace> | |
<Keyword>Win32Proj</Keyword> | |
</PropertyGroup> | |
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | |
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | |
<ConfigurationType>DynamicLibrary</ConfigurationType> | |
<CharacterSet>MultiByte</CharacterSet> | |
<WholeProgramOptimization>true</WholeProgramOptimization> | |
<PlatformToolset>v100</PlatformToolset> | |
</PropertyGroup> | |
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | |
<ConfigurationType>DynamicLibrary</ConfigurationType> | |
<CharacterSet>NotSet</CharacterSet> | |
<PlatformToolset>v90</PlatformToolset> | |
</PropertyGroup> | |
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | |
<ImportGroup Label="ExtensionSettings"> | |
</ImportGroup> | |
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> | |
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
</ImportGroup> | |
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> | |
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
</ImportGroup> | |
<PropertyGroup Label="UserMacros" /> | |
<PropertyGroup> | |
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion> | |
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir> | |
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> | |
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> | |
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir> | |
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> | |
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> | |
</PropertyGroup> | |
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
<ClCompile> | |
<Optimization>Disabled</Optimization> | |
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;YSF_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
<StringPooling>true</StringPooling> | |
<MinimalRebuild>true</MinimalRebuild> | |
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | |
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> | |
<PrecompiledHeader> | |
</PrecompiledHeader> | |
<WarningLevel>Level3</WarningLevel> | |
<DebugInformationFormat>EditAndContinue</DebugInformationFormat> | |
<DisableSpecificWarnings>4995;%(DisableSpecificWarnings)</DisableSpecificWarnings> | |
</ClCompile> | |
<Link> | |
<OutputFile>C:\Program Files (x86)\Rockstar Games\GTA San Andreas\SERVER\plugins\YSF.dll</OutputFile> | |
<ModuleDefinitionFile>YSF.def</ModuleDefinitionFile> | |
<GenerateDebugInformation>true</GenerateDebugInformation> | |
<SubSystem>Windows</SubSystem> | |
<RandomizedBaseAddress>false</RandomizedBaseAddress> | |
<DataExecutionPrevention> | |
</DataExecutionPrevention> | |
<TargetMachine>MachineX86</TargetMachine> | |
</Link> | |
</ItemDefinitionGroup> | |
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |
<ClCompile> | |
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;YSF_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
<SmallerTypeCheck>false</SmallerTypeCheck> | |
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> | |
<FloatingPointModel>Strict</FloatingPointModel> | |
<PrecompiledHeader>NotUsing</PrecompiledHeader> | |
<WarningLevel>Level3</WarningLevel> | |
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | |
<DisableSpecificWarnings>4995;%(DisableSpecificWarnings)</DisableSpecificWarnings> | |
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> | |
<IntrinsicFunctions>true</IntrinsicFunctions> | |
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> | |
<OmitFramePointers>true</OmitFramePointers> | |
<WholeProgramOptimization>true</WholeProgramOptimization> | |
<PrecompiledHeaderFile>main.h</PrecompiledHeaderFile> | |
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions> | |
</ClCompile> | |
<Link> | |
<OutputFile>$(SolutionDir)$(Configuration)\YSF.dll</OutputFile> | |
<ModuleDefinitionFile>YSF.def</ModuleDefinitionFile> | |
<GenerateDebugInformation>true</GenerateDebugInformation> | |
<SubSystem>Windows</SubSystem> | |
<OptimizeReferences>true</OptimizeReferences> | |
<EnableCOMDATFolding>true</EnableCOMDATFolding> | |
<RandomizedBaseAddress>false</RandomizedBaseAddress> | |
<DataExecutionPrevention> | |
</DataExecutionPrevention> | |
<TargetMachine>MachineX86</TargetMachine> | |
<AdditionalDependencies>psapi.lib;%(AdditionalDependencies)</AdditionalDependencies> | |
</Link> | |
</ItemDefinitionGroup> | |
<ItemGroup> | |
<ClCompile Include="Addresses.cpp" /> | |
<ClCompile Include="BitStream.cpp"> | |
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader> | |
</ClCompile> | |
<ClCompile Include="CModelSizes.cpp" /> | |
<ClCompile Include="CPlayer.cpp" /> | |
<ClCompile Include="CServer.cpp" /> | |
<ClCompile Include="Hooks.cpp" /> | |
<ClCompile Include="Inlines.cpp" /> | |
<ClCompile Include="PatternScan.cpp" /> | |
<ClCompile Include="RPCs.cpp" /> | |
<ClCompile Include="Scripting.cpp" /> | |
<ClCompile Include="SDK\amxplugin.cpp"> | |
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader> | |
</ClCompile> | |
<ClCompile Include="SDK\amx\getch.c"> | |
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader> | |
</ClCompile> | |
<ClCompile Include="main.cpp"> | |
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> | |
</ClCompile> | |
</ItemGroup> | |
<ItemGroup> | |
<ClInclude Include="Addresses.h" /> | |
<ClInclude Include="BitStream.h" /> | |
<ClInclude Include="CModelSizes.h" /> | |
<ClInclude Include="CPlayer.h" /> | |
<ClInclude Include="CServer.h" /> | |
<ClInclude Include="CTypes.h" /> | |
<ClInclude Include="CVector.h" /> | |
<ClInclude Include="Inlines.h" /> | |
<ClInclude Include="PatternScan.h" /> | |
<ClInclude Include="RPCs.h" /> | |
<ClInclude Include="Scripting.h" /> | |
<ClInclude Include="SDK\amx\amx.h" /> | |
<ClInclude Include="SDK\amx\getch.h" /> | |
<ClInclude Include="SDK\plugin.h" /> | |
<ClInclude Include="SDK\plugincommon.h" /> | |
<ClInclude Include="SDK\amx\sclinux.h" /> | |
<ClInclude Include="main.h" /> | |
<ClInclude Include="Structs.h" /> | |
</ItemGroup> | |
<ItemGroup> | |
<None Include="YSF.def" /> | |
</ItemGroup> | |
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | |
<ImportGroup Label="ExtensionTargets"> | |
</ImportGroup> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment