daily pastebin goal
28%
SHARE
TWEET

SsVars v1.0

Paulo_AttacK Oct 5th, 2012 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define SsIntSet(%0,%1); setproperty(0,(format(SsVarName[SsCount++], 24, %0),%0),%1);
  2. #define SsIntGet(%0) getproperty(0,%0)
  3. #define MAX_VARS (0x80)
  4.  
  5. new SsVarName[MAX_VARS][24], SsCount, bool: Ss_OGMI = false, bool: Ss_OGME = false;
  6.  
  7. public OnGameModeInit() {
  8.         Ss_OGMI = funcidx(#Ss_OnGameModeInit) != -1;
  9.         Ss_OGME = funcidx(#Ss_OnGameModeExit) != -1;
  10.        
  11.         if(fexist("SsVars.temp")) {
  12.                 static File: SsFile, SsStr[24], SsVarNome[24], Ss;
  13.                 if((SsFile = fopen("SsVars.temp", io_read))) {
  14.                         while(fread(SsFile, SsStr)) {
  15.                                 while(SsStr[Ss] != '=') SsVarNome[Ss] = SsStr[Ss++];
  16.                                 setproperty(0, SsVarNome, strval(SsStr[++Ss])); Ss = 0;
  17.                         }
  18.                         fclose(SsFile);
  19.                         fremove("SsVars.temp");
  20.                 }
  21.         }
  22.         return Ss_OGMI ? CallLocalFunction(#Ss_OnGameModeInit, #) : 1;
  23. }
  24.  
  25. #if defined _ALS_OnGameModeInit
  26.         #undef OnGameModeInit
  27. #else
  28.         #define _ALS_OnGameModeInit
  29. #endif
  30. #define OnGameModeInit Ss_OnGameModeInit
  31. forward Ss_OnGameModeInit();
  32.  
  33. public OnGameModeExit() {
  34.         static File: SsFile, SsStr[MAX_VARS], Ss;
  35.         if((SsFile = fopen("SsVars.temp", io_write))) {
  36.                 while(Ss != SsCount) {
  37.                         format(SsStr, MAX_VARS, "%s=%i\r\n", SsVarName[Ss], getproperty(0, SsVarName[Ss]));
  38.                         fwrite(SsFile, (++Ss, SsStr));
  39.                 }
  40.                 fclose(SsFile);
  41.         }
  42.         return Ss_OGME ? CallLocalFunction(#Ss_OnGameModeExit, #) : 1;
  43. }
  44.  
  45. #if defined _ALS_OnGameModeExit
  46.         #undef OnGameModeExit
  47. #else
  48.         #define _ALS_OnGameModeExit
  49. #endif
  50. #define OnGameModeExit Ss_OnGameModeExit
  51. forward Ss_OnGameModeExit();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top