Advertisement
elrooT

Simple PMs! 0.1 ~

Sep 27th, 2011
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.02 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf2>
  4.  
  5. #define COLOR_RED       /**/    0xFF0000AA
  6. #define COLOR_YELLOW    /**/    0xFFFF00AA
  7. #define COLOR_GREEN     /**/    0x66CC99AA
  8.  
  9. #pragma tabsize 0
  10.  
  11. public OnFilterScriptInit()
  12. {
  13.     print("--------------------------------");
  14.     print("---Simple PM System! by rooT.---");
  15.     print("-------------Loaded-------------");
  16.     print("--------------------------------");
  17.     return 1;
  18. }
  19.  
  20. public OnFilterScriptExit()
  21. {
  22.     print("--------------------------------");
  23.     print("---Simple PM System! by rooT.---");
  24.     print("------------Unloaded------------");
  25.     print("--------------------------------");
  26.    
  27.     for(new i = 0; i < MAX_PLAYERS; i++)
  28.     {
  29.         if(IsPlayerConnected(i))
  30.         {
  31.             DeletePVar(i, "Received");
  32.             DeletePVar(i, "LastPmFrom");
  33.             DeletePVar(i, "PMs");
  34.         }
  35.     }
  36.     return 1;
  37. }
  38.  
  39. new str[128], pname[MAX_PLAYER_NAME], msje[80], playerid2;
  40.  
  41. CMD:pm(playerid, params[])
  42. {
  43.     if(!sscanf(params, "rs[80]", playerid2, msje))
  44.     {
  45.         if(playerid2 == playerid) return SendClientMessage(playerid, COLOR_RED, "No puedes enviarte un PM a ti mismo.");
  46.         if(!IsPlayerConnected(playerid2)) return SendClientMessage(playerid, COLOR_RED, "Este jugador no esta conectado.");
  47.         if(GetPVarInt(playerid2, "PMs") == 0) return SendClientMessage(playerid, COLOR_RED, "Este jugador ha desactivado los PMs!");
  48.        
  49.         GetPlayerName(playerid, pname, sizeof(pname));
  50.        
  51.         format(str, sizeof(str), "PM de %s: %s", pname, msje);
  52.         SendClientMessage(playerid2, COLOR_GREEN, str);
  53.        
  54.         SetPVarInt(playerid2, "Received", 1);
  55.         SetPVarInt(playerid2, "LastPmFrom", playerid);
  56.        
  57.     } else return SendClientMessage(playerid, COLOR_RED, "Uso: /pm <playerid> <mensaje>");
  58.     return 1;
  59. }
  60.  
  61. CMD:r(playerid, params[])
  62. {
  63.     if(GetPVarInt(playerid, "Received") == 0) return SendClientMessage(playerid, COLOR_RED, "No has recibido ningun PM.");
  64.     if(!sscanf(params, "s[80]", msje))
  65.     {
  66.         playerid2 = GetPVarInt(playerid, "LastPmFrom");
  67.        
  68.         if(!IsPlayerConnected(playerid2)) return SendClientMessage(playerid, COLOR_RED, "Este jugador no esta conectado.");
  69.         if(GetPVarInt(playerid2, "PMs") == 0) return SendClientMessage(playerid, COLOR_RED, "Este jugador ha desactivado los PMs!");
  70.        
  71.         GetPlayerName(playerid, pname, sizeof(pname));
  72.        
  73.         format(str, sizeof(str), "PM de %s: %s", pname, msje);
  74.         SendClientMessage(playerid2, COLOR_GREEN, str);
  75.        
  76.         SetPVarInt(playerid2, "Received", 1);
  77.         SetPVarInt(playerid2, "LastPmFrom", playerid);
  78.        
  79.         SetPVarInt(playerid, "Received", 0);
  80.         DeletePVar(playerid, "LastPmFrom");
  81.        
  82.     } else return SendClientMessage(playerid, COLOR_RED, "Uso: /r <mensaje>");
  83.     return 1;
  84. }
  85.  
  86. CMD:switchpm(playerid, params[])
  87. {
  88.     if(GetPVarInt(playerid, "PMs") == 1)
  89.     {
  90.         SetPVarInt(playerid, "PMs", 0);
  91.         SendClientMessage(playerid, COLOR_YELLOW, "Ya no recibiras PMs de otros usuarios!");
  92.     }
  93.     else
  94.     {
  95.         SetPVarInt(playerid, "PMs", 1);
  96.         SendClientMessage(playerid, COLOR_YELLOW, "Ahora recibiras PMs de otros usuarios!");
  97.     }
  98.     return 1;
  99. }
  100.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement