18.02.2014, 17:31
Quote:
Why would you like to check if the player that is executing the command is online?
|
The player has to be connected if he has to use the command. xD
You could use my script if you want, works!
Code:
COMMAND:pm(playerid,params[]) { static id,msg[112],string[128]; if(sscanf(params,"us[112]",id,msg)) { return SendClientMessage(playerid,COLOR_GREY,"Usage:/pm [Name/ID] [Message]"); } if(id == playerid) return SendClientMessage(playerid,COLOR_RED,"/pm>>You cannot send a private message to yourself."); if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"/pm>>Please give a valid player id/name."); if (PlayerAC[id][Alive]) return SendClientMessage(playerid,COLOR_RED,"/pm>>Player cannot recieve private messages while he isen't spawned."); if(PlayerData[id][DoNotRecievePMs]) return SendClientMessage(playerid,COLOR_RED,"/pm>>Player has disabled private messages for this session."); if(PlayerData[playerid][IgnorePM][id>>5] & (1<<(id & 31))) return SendClientMessage(playerid,COLOR_RED,"/pm>>The player is ignoring you."); PlayerData[id][LastPMSentBy] = playerid; format(msg,sizeof(string),"PM from %s(%d):%s",PlayerData[playerid][Name],playerid,msg); SendClientMessage(id,COLOR_YELLOW,string); SendClientMessage(id,COLOR_YELLOW,"/reply OR /r for quick reply"); format(msg,sizeof(string),"PM to %s(%d):%s",PlayerData[id][Name],id,msg); SendClientMessage(playerid,COLOR_YELLOW,string); return 1; } COMMAND:reply(playerid,params[]) { static id,msg[112]; if(sscanf(params,"s[112]",msg)) { return SendClientMessage(playerid,COLOR_GREY,"Usage:/reply [Message]"); } id = PlayerData[id][LastPMSentBy]; if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"/reply>>The player has logged out."); if (PlayerAC[id][Alive]) return SendClientMessage(playerid,COLOR_RED,"/reply>>Player cannot recieve private messages while he hasn't spawned yet."); if(PlayerData[id][DoNotRecievePMs]) return SendClientMessage(playerid,COLOR_RED,"/reply>>Player has disabled private messages for this session."); if(PlayerData[playerid][IgnorePM][id>>5] & (1<<(id & 31))) return SendClientMessage(playerid,COLOR_RED,"/reply>>The player is ignoring you."); if(PlayerData[id][LastPMSentBy] == -1) return SendClientMessage(playerid,COLOR_RED,"/r>>You've not recieved any recent private message to use quick reply."); PlayerData[id][LastPMSentBy] = playerid; format(msg,sizeof(msg),"PM from %s(%d):%s",PlayerData[playerid][Name],playerid,msg); SendClientMessage(id,COLOR_YELLOW,msg); SendClientMessage(id,COLOR_YELLOW,"/reply OR /r for quick reply"); format(msg,sizeof(msg),"PM to %s(%d):%s",PlayerData[id][Name],id,msg); SendClientMessage(playerid,COLOR_YELLOW,msg); return 1; } COMMAND:r(playerid,params[]) { static id,msg[112]; if(sscanf(params,"s[112]",msg)) { return SendClientMessage(playerid,COLOR_GREY,"Usage:/r [Message]"); } id = PlayerData[id][LastPMSentBy]; if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"/r>>The player has logged out."); if (PlayerAC[id][Alive]) return SendClientMessage(playerid,COLOR_RED,"/r>>Player cannot recieve private messages while he hasn't spawned yet."); if(PlayerData[id][DoNotRecievePMs]) return SendClientMessage(playerid,COLOR_RED,"/r>>Player has disabled private messages for this session."); if(PlayerData[playerid][IgnorePM][id>>5] & (1<<(id & 31))) return SendClientMessage(playerid,COLOR_RED,"/r>>The player is ignoring you."); if(PlayerData[id][LastPMSentBy] == -1) return SendClientMessage(playerid,COLOR_RED,"/r>>You've not recieved any recent private message to use quick reply."); PlayerData[id][LastPMSentBy] = playerid; format(msg,sizeof(msg),"PM from %s(%d):%s",PlayerData[playerid][Name],playerid,msg); SendClientMessage(id,COLOR_YELLOW,msg); SendClientMessage(id,COLOR_YELLOW,"/reply OR /r for quick reply"); format(msg,sizeof(msg),"PM to %s(%d):%s",PlayerData[id][Name],id,msg); SendClientMessage(playerid,COLOR_YELLOW,msg); return 1; } COMMAND:togglepm(playerid,params[]) { switch((PlayerData[playerid][DoNotRecievePMs] = !PlayerData[playerid][DoNotRecievePMs])) { case true: { return SendClientMessage(playerid,COLOR_YELLOW,"You've has disabled private messages./togglepm to enable them."); } case false: { return SendClientMessage(playerid,COLOR_YELLOW,"You've has enabled private messages./togglepm to disable them."); } } return 1; } COMMAND:ignore(playerid,params[]) { new id,msg[98+MAX_PLAYER_NAME]; if(sscanf(params,"u",id)) { return SendClientMessage(playerid,COLOR_GREY,"Usage>>/ignore [Name/ID]"); } if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"/ignore:Invalid Player"); if(id == playerid) return SendClientMessage(playerid,COLOR_RED,"/ignore:You cannot ignore yourself."); switch(!!(PlayerData[playerid][IgnorePM][id>>5] ^= 1 << (id & 31))) { case true: { format(msg,sizeof(msg),"You are ignoring %s(%d)'s private messages./ignore [Name/ID] to stop ignoring.",PlayerData[id][Name],id); return SendClientMessage(playerid,COLOR_YELLOW,msg); } case false: { format(msg,sizeof(msg),"You are stopped ignoring %s(%d)'s private messages./ignore [Name/ID] to ignore private messages.",PlayerData[id][Name],id); return SendClientMessage(playerid,COLOR_YELLOW,msg); } } return 1; }