Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Includes:
- #include <iostream>
- #include <stdio.h>
- #include <stdlib.h>
- /* SA:MP GDK: */
- #include <sampgdk\a_players.hpp>
- #include <sampgdk\a_samp.hpp>
- #include <sampgdk\core.hpp>
- #include <sampgdk\plugin.h>
- // Macros:
- #define STANDARD_EXPORT(class_name) \
- PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports() {return SUPPORTS_VERSION | SUPPORTS_PROCESS_TICK;}\
- PLUGIN_EXPORT bool PLUGIN_CALL Load(void ** ppData) {return class_name.Load(ppData) >= NULL;}\
- PLUGIN_EXPORT void PLUGIN_CALL Unload() {class_name.Unload();}\
- PLUGIN_EXPORT void PLUGIN_CALL ProcessTick() {class_name.ProcessTimers();}
- // Variables:
- static ThisPlugin PSD;
- // Public functions:
- PLUGIN_EXPORT bool PLUGIN_CALL OnGameModeInit() {
- FILE * File;
- long Size;
- char * buffer;
- size_t result;
- File = fopen("F:\\Rockstar Games\\GTA San Andreas\\data\\handling.cfg", "r");
- if(File == NULL) {
- sampgdk_logprintf("NIE ZNALEZIONO PLIKU!");
- //fputs("Nie znaleziono pliku!", stderr); exit(1);
- }
- fseek(File, 0, SEEK_END);
- Size = ftell(File);
- rewind(File);
- buffer = (char *) malloc(sizeof(char) * Size);
- if(buffer == NULL) {
- sampgdk_logprintf("BRAK PAMIĘCI!");
- //fputs("Brak pamięci!", stderr); exit(2);
- }
- result = fread(buffer, 1, Size, File);
- const char * shift[1000];
- if(result != Size) {
- if(strcmp("LANDSTAL", buffer)) {
- int k = 0;
- while(File >> shift[k]) {
- for(int i = 0; i < k; i++) {
- sampgdk_logprintf(shift[i]);
- }
- }
- sampgdk_logprintf("Odczytano plik.");
- }
- else sampgdk_logprintf("BŁĄD ODCZYTU PLIKU!");
- //fputs("Błąd odczytu pliku!", stderr); exit(3);
- }
- fclose(File);
- free(buffer);
- return false;
- }
- STANDARD_EXPORT(PSD);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement