Advertisement
Guest User

Private Message By Misho Version 0.5(Fixed)

a guest
Jul 31st, 2012
873
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.41 KB | None | 0 0
  1. //Private System System By Misho Version 0.5
  2. //Inludes
  3. #include a_samp
  4. #include sscanf2
  5. #include ysi\y_commands
  6. #include ysi\y_ini
  7. //Colors
  8. #define Red       0xFF0000C8
  9. #define Blue       0x0000FFC8
  10. #define LightGreen       0x80FF00C8
  11. #define Orange      0xFF8000C8
  12. //Define The Private Message File That Located In The Script Files
  13. #define pms "pms.txt"
  14. //Define The Private Message Dialog
  15. #define pm1 109
  16. #define pm2 110
  17. //Variables
  18. new mytpms[MAX_PLAYERS];
  19. new allpms[MAX_PLAYERS];
  20.  
  21. new dtarget;
  22.  
  23. //Commands
  24. //NON Dialog
  25. /*YCMD:pm(playerid,params[],help){
  26.         new target,message[200],me[MAX_PLAYER_NAME],string[200],tname[MAX_PLAYER_NAME];
  27.         GetPlayerName(playerid,me,sizeof(me));
  28.         GetPlayerName(target,tname,sizeof(tname));
  29.        
  30.         //if(muted[playerid] == 1) return SendClientMessage(playerid,Red,"ERROR: You're Muted!");//Change It To Your Own Vairable
  31.         if(allpms[playerid] == 0) return SendClientMessage(playerid,Red,"ERROR: The Admin Had Turned Off All The Private Messages!");
  32.         if(sscanf(params, "us[91]", target, message)) return SendClientMessage(playerid,Blue, "USAGE: /PM [playerid] [Message]");
  33.         if(!IsPlayerConnected(target)) return SendClientMessage(playerid,Red,"ERROR: This Player Isn't Connected In This Server");
  34.         if(target == playerid) return SendClientMessage(playerid,Red,"ERROR: You Cant't Send Private Message To Yourself");
  35.         if(mytpms[target] == 0) return SendClientMessage(playerid,Red,"ERROR: That Player Turned Off His/Her PMS");
  36.         //if(muted[target] == 1) return SendClientMessage(playerid,Red,"ERROR: This Player Is Muted!");//Change It To Your Own Vairable
  37.         format(string,sizeof(string),"(%s) Has Sent To You A PM (%s)",me, message);
  38.         SendClientMessage(target,LightGreen,string);
  39.         format(string,sizeof string,"The PM (%s) Has Been Sent To (%s)!",message,tname);
  40.         SendClientMessage(playerid,Orange,string);
  41.         PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
  42.         PlayerPlaySound(target,1085,0.0,0.0,0.0);
  43.         new INI:pmslog = INI_Open(pms);
  44.         new pmlogstring[200];
  45.         format(pmlogstring, sizeof pmlogstring, "Private Message From (%s) To (%s) (Message:%s)",me,tname,message);
  46.         INI_WriteString(pmslog,"Private Message",pmlogstring);
  47.         INI_Close(pmslog);
  48.         return 1;}*/
  49.  
  50. //Dialog
  51. YCMD:pm(playerid,params[],help){
  52.     //if(muted[playerid] == 1) return SendClientMessage(playerid,Red,"ERROR: You're Muted!"); Change It To Your Own Vairable
  53.     if(allpms[playerid] == 0) return SendClientMessage(playerid,Red,"ERROR: The Admin Had Turned Off All The Private Messages!");
  54.     if(sscanf(params, "u", dtarget)) return SendClientMessage(playerid,Blue, "USAGE: /PM [playerid]");
  55.     if(!IsPlayerConnected(dtarget)) return SendClientMessage(playerid,Red,"ERROR: This Player Isn't Connected In This Server");
  56.     if(dtarget == playerid) return SendClientMessage(playerid,Red,"ERROR: You Cant't Send Private Message To Yourself");
  57.     if(mytpms[dtarget] == 0) return SendClientMessage(playerid,Red,"ERROR: That Player Turned Off His/Her PMS");
  58.     //if(muted[dtarget] == 1) return SendClientMessage(playerid,Red,"ERROR: This Player Is Muted!"); Change It To Your Own Vairable
  59.     ShowPlayerDialog(playerid,pm1,DIALOG_STYLE_INPUT,"private Message!","Send Your Message Here","Send","Close");
  60.     return 1;}
  61.    
  62. CMD:mypms( playerid, params[ ] ){
  63.     if(mytpms[playerid] == 1){
  64.         mytpms[playerid] = 0;
  65.         SendClientMessage(playerid, Red, "You Truned Off The Private Messages That Any One Can't Send To You A Private Messages!");}
  66.     else if(mytpms[playerid] == 0){
  67.         mytpms[playerid] = 1;
  68.         SendClientMessage(playerid, LightGreen, "You Truned On The Private Messages That Any One Can Send To You A Private Messages!");}
  69.     return 1;}
  70.    
  71. CMD:allpms( playerid, params[ ] ){
  72.     if(allpms[playerid] == 1){
  73.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,Red,"You're Not RCON Admin");
  74.         allpms[playerid] = 0;
  75.         SendClientMessage(playerid, Red, "You Truned Off All The Private Messages That No One Can Send Private Message To The Other!");}
  76.     else if(allpms[playerid] == 0){
  77.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,Red,"You're Not RCON Admin");
  78.         allpms[playerid] = 1;
  79.         SendClientMessage(playerid, LightGreen, "You Truned On All The Private Messages That Any One Can Send Private Message To The Other!");}
  80.     return 1;}
  81.  
  82.  
  83. //Callbacks
  84. public OnFilterScriptInit(){
  85.     print(" PM SYSTEM By Mi$h0!");
  86.     return 1;}
  87.    
  88. public OnPlayerConnect(playerid){
  89.     mytpms[playerid] = 1;
  90.     allpms[playerid] = 1;
  91.     return 1;}
  92.    
  93. public OnPlayerClickPlayer(playerid, clickedplayerid, source){
  94.     SetPVarInt(playerid,"ClickedPlayer",clickedplayerid);
  95.     //if(muted[playerid] == 1) return SendClientMessage(playerid,Red,"ERROR: You're Muted!"); Change It To Your Own Vairable
  96.     if(allpms[playerid] == 0) return SendClientMessage(playerid,Red,"ERROR: The Admin Had Turned Off All The Private Messages!");
  97.     if(clickedplayerid == playerid) return SendClientMessage(playerid,Red,"ERROR: You Cant't Send Private Message To Yourself");
  98.     if(mytpms[clickedplayerid] == 0) return SendClientMessage(playerid,Red,"ERROR: That Player Turned Off His/Her PMS");
  99.     //if(muted[clickedplayerid] == 1) return SendClientMessage(playerid,Red,"ERROR: This Player Is Muted!"); Change It To Your Own Vairable
  100.     ShowPlayerDialog(playerid,pm2,DIALOG_STYLE_INPUT,"private Message!","Send Your Message Here","Send","Close");
  101.     return 1;}
  102.  
  103. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
  104.     if(dialogid == pm2 && response == 1) {
  105.         new string[200], me[MAX_PLAYER_NAME],Target[MAX_PLAYER_NAME];
  106.         new clickedplayer = GetPVarInt(playerid,"ClickedPlayer");
  107.         GetPlayerName(clickedplayer,Target,sizeof Target);
  108.         GetPlayerName(playerid,me,sizeof me);
  109.         format(string,sizeof string,"(%s) Has Sent To You A PM (%s)",me,inputtext);
  110.         SendClientMessage(clickedplayer,LightGreen,string);
  111.         format(string,sizeof string,"The PM (%s) Has Been Sent To (%s)!",inputtext,Target);
  112.         SendClientMessage(playerid,Orange,string);
  113.         PlayerPlaySound(clickedplayer,1085,0.0,0.0,0.0);
  114.         PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
  115.         new INI:pmslog = INI_Open(pms);
  116.         new pmlogstring[200];
  117.         format(pmlogstring, sizeof pmlogstring, "Private Message From (%s) To (%s) (Message:%s)",me,Target,inputtext);
  118.         INI_WriteString(pmslog,"Private Message",pmlogstring);
  119.         INI_Close(pmslog);
  120.         return 1;}
  121.  
  122.     if(dialogid == pm1 && response == 1) {
  123.         new me[MAX_PLAYER_NAME],string[200],tname[MAX_PLAYER_NAME];
  124.         GetPlayerName(dtarget,tname,sizeof(tname));
  125.         GetPlayerName(playerid,me,sizeof(me));
  126.         format(string,sizeof string,"(%s) Has Sent To You A PM (%s)",me,inputtext);
  127.         SendClientMessage(dtarget,LightGreen,string);
  128.         format(string,sizeof string,"The PM (%s) Has Been Sent To (%s)!",inputtext,tname);
  129.         SendClientMessage(playerid,Orange,string);
  130.         PlayerPlaySound(dtarget,1085,0.0,0.0,0.0);
  131.         PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
  132.         new INI:pmslog = INI_Open(pms);
  133.         new pmlogstring[200];
  134.         format(pmlogstring, sizeof pmlogstring, "Private Message From (%s) To (%s) (Message:%s)",me,tname,inputtext);
  135.         INI_WriteString(pmslog,"Private Message",pmlogstring);
  136.         INI_Close(pmslog);
  137.         return 1;}
  138.  
  139.     return 1;}
  140. //Enjoy By Using It
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement