Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Private System System By Misho Version 0.5
- //Inludes
- #include a_samp
- #include sscanf2
- #include ysi\y_commands
- #include ysi\y_ini
- //Colors
- #define Red 0xFF0000C8
- #define Blue 0x0000FFC8
- #define LightGreen 0x80FF00C8
- #define Orange 0xFF8000C8
- //Define The Private Message File That Located In The Script Files
- #define pms "pms.txt"
- //Define The Private Message Dialog
- #define pm1 109
- #define pm2 110
- //Variables
- new mytpms[MAX_PLAYERS];
- new allpms[MAX_PLAYERS];
- new dtarget;
- //Commands
- //NON Dialog
- /*YCMD:pm(playerid,params[],help){
- new target,message[200],me[MAX_PLAYER_NAME],string[200],tname[MAX_PLAYER_NAME];
- GetPlayerName(playerid,me,sizeof(me));
- GetPlayerName(target,tname,sizeof(tname));
- //if(muted[playerid] == 1) return SendClientMessage(playerid,Red,"ERROR: You're Muted!");//Change It To Your Own Vairable
- if(allpms[playerid] == 0) return SendClientMessage(playerid,Red,"ERROR: The Admin Had Turned Off All The Private Messages!");
- if(sscanf(params, "us[91]", target, message)) return SendClientMessage(playerid,Blue, "USAGE: /PM [playerid] [Message]");
- if(!IsPlayerConnected(target)) return SendClientMessage(playerid,Red,"ERROR: This Player Isn't Connected In This Server");
- if(target == playerid) return SendClientMessage(playerid,Red,"ERROR: You Cant't Send Private Message To Yourself");
- if(mytpms[target] == 0) return SendClientMessage(playerid,Red,"ERROR: That Player Turned Off His/Her PMS");
- //if(muted[target] == 1) return SendClientMessage(playerid,Red,"ERROR: This Player Is Muted!");//Change It To Your Own Vairable
- format(string,sizeof(string),"(%s) Has Sent To You A PM (%s)",me, message);
- SendClientMessage(target,LightGreen,string);
- format(string,sizeof string,"The PM (%s) Has Been Sent To (%s)!",message,tname);
- SendClientMessage(playerid,Orange,string);
- PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
- PlayerPlaySound(target,1085,0.0,0.0,0.0);
- new INI:pmslog = INI_Open(pms);
- new pmlogstring[200];
- format(pmlogstring, sizeof pmlogstring, "Private Message From (%s) To (%s) (Message:%s)",me,tname,message);
- INI_WriteString(pmslog,"Private Message",pmlogstring);
- INI_Close(pmslog);
- return 1;}*/
- //Dialog
- YCMD:pm(playerid,params[],help){
- //if(muted[playerid] == 1) return SendClientMessage(playerid,Red,"ERROR: You're Muted!"); Change It To Your Own Vairable
- if(allpms[playerid] == 0) return SendClientMessage(playerid,Red,"ERROR: The Admin Had Turned Off All The Private Messages!");
- if(sscanf(params, "u", dtarget)) return SendClientMessage(playerid,Blue, "USAGE: /PM [playerid]");
- if(!IsPlayerConnected(dtarget)) return SendClientMessage(playerid,Red,"ERROR: This Player Isn't Connected In This Server");
- if(dtarget == playerid) return SendClientMessage(playerid,Red,"ERROR: You Cant't Send Private Message To Yourself");
- if(mytpms[dtarget] == 0) return SendClientMessage(playerid,Red,"ERROR: That Player Turned Off His/Her PMS");
- //if(muted[dtarget] == 1) return SendClientMessage(playerid,Red,"ERROR: This Player Is Muted!"); Change It To Your Own Vairable
- ShowPlayerDialog(playerid,pm1,DIALOG_STYLE_INPUT,"private Message!","Send Your Message Here","Send","Close");
- return 1;}
- CMD:mypms( playerid, params[ ] ){
- if(mytpms[playerid] == 1){
- mytpms[playerid] = 0;
- SendClientMessage(playerid, Red, "You Truned Off The Private Messages That Any One Can't Send To You A Private Messages!");}
- else if(mytpms[playerid] == 0){
- mytpms[playerid] = 1;
- SendClientMessage(playerid, LightGreen, "You Truned On The Private Messages That Any One Can Send To You A Private Messages!");}
- return 1;}
- CMD:allpms( playerid, params[ ] ){
- if(allpms[playerid] == 1){
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,Red,"You're Not RCON Admin");
- allpms[playerid] = 0;
- SendClientMessage(playerid, Red, "You Truned Off All The Private Messages That No One Can Send Private Message To The Other!");}
- else if(allpms[playerid] == 0){
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,Red,"You're Not RCON Admin");
- allpms[playerid] = 1;
- SendClientMessage(playerid, LightGreen, "You Truned On All The Private Messages That Any One Can Send Private Message To The Other!");}
- return 1;}
- //Callbacks
- public OnFilterScriptInit(){
- print(" PM SYSTEM By Mi$h0!");
- return 1;}
- public OnPlayerConnect(playerid){
- mytpms[playerid] = 1;
- allpms[playerid] = 1;
- return 1;}
- public OnPlayerClickPlayer(playerid, clickedplayerid, source){
- SetPVarInt(playerid,"ClickedPlayer",clickedplayerid);
- //if(muted[playerid] == 1) return SendClientMessage(playerid,Red,"ERROR: You're Muted!"); Change It To Your Own Vairable
- if(allpms[playerid] == 0) return SendClientMessage(playerid,Red,"ERROR: The Admin Had Turned Off All The Private Messages!");
- if(clickedplayerid == playerid) return SendClientMessage(playerid,Red,"ERROR: You Cant't Send Private Message To Yourself");
- if(mytpms[clickedplayerid] == 0) return SendClientMessage(playerid,Red,"ERROR: That Player Turned Off His/Her PMS");
- //if(muted[clickedplayerid] == 1) return SendClientMessage(playerid,Red,"ERROR: This Player Is Muted!"); Change It To Your Own Vairable
- ShowPlayerDialog(playerid,pm2,DIALOG_STYLE_INPUT,"private Message!","Send Your Message Here","Send","Close");
- return 1;}
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
- if(dialogid == pm2 && response == 1) {
- new string[200], me[MAX_PLAYER_NAME],Target[MAX_PLAYER_NAME];
- new clickedplayer = GetPVarInt(playerid,"ClickedPlayer");
- GetPlayerName(clickedplayer,Target,sizeof Target);
- GetPlayerName(playerid,me,sizeof me);
- format(string,sizeof string,"(%s) Has Sent To You A PM (%s)",me,inputtext);
- SendClientMessage(clickedplayer,LightGreen,string);
- format(string,sizeof string,"The PM (%s) Has Been Sent To (%s)!",inputtext,Target);
- SendClientMessage(playerid,Orange,string);
- PlayerPlaySound(clickedplayer,1085,0.0,0.0,0.0);
- PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
- new INI:pmslog = INI_Open(pms);
- new pmlogstring[200];
- format(pmlogstring, sizeof pmlogstring, "Private Message From (%s) To (%s) (Message:%s)",me,Target,inputtext);
- INI_WriteString(pmslog,"Private Message",pmlogstring);
- INI_Close(pmslog);
- return 1;}
- if(dialogid == pm1 && response == 1) {
- new me[MAX_PLAYER_NAME],string[200],tname[MAX_PLAYER_NAME];
- GetPlayerName(dtarget,tname,sizeof(tname));
- GetPlayerName(playerid,me,sizeof(me));
- format(string,sizeof string,"(%s) Has Sent To You A PM (%s)",me,inputtext);
- SendClientMessage(dtarget,LightGreen,string);
- format(string,sizeof string,"The PM (%s) Has Been Sent To (%s)!",inputtext,tname);
- SendClientMessage(playerid,Orange,string);
- PlayerPlaySound(dtarget,1085,0.0,0.0,0.0);
- PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
- new INI:pmslog = INI_Open(pms);
- new pmlogstring[200];
- format(pmlogstring, sizeof pmlogstring, "Private Message From (%s) To (%s) (Message:%s)",me,tname,inputtext);
- INI_WriteString(pmslog,"Private Message",pmlogstring);
- INI_Close(pmslog);
- return 1;}
- return 1;}
- //Enjoy By Using It
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement