Command Help - Diti1 - 18.01.2015
hey im trying to make a block/unblock cmd but i cant pls someone help me
Pm codes
PHP код:
COMMAND:pm(playerid, params[])
{
if(GetPVarInt(playerid, "togPM") == 1) return SendClientError(playerid, "You have private mesasges disables. Use /togpm to re-enable.");
new iPlayer, iText[ 128 ];
if( sscanf ( params, "us", iPlayer, iText)) return SCP(playerid, "[PlayerID/PartOfName] [message]");
if(PlayerTemp[playerid][muted]) return SendClientError(playerid, "You are muted!");
if(FindIP(iText))
{
KickReas("[SERVER]",playerid,"Attempting to advertise IP's!");
return 1;
}
if(GetPVarInt(iPlayer, "togPM") == 1 && !GetAdminLevel(playerid)) return SendClientError(playerid, "That player has blocked incoming private messages.");
format(iStr, sizeof(iStr), "(( %s(%d): %s ))", RPName(playerid), playerid, iText);
SendClientMessage(iPlayer, 0xFF66FFAA, iStr);
if(PlayerTemp[iPlayer][lastpm] == 666) SendClientMessage(iPlayer, -1, "{d9d9d5} You can use {b4b4b1}\"/re [message]\"{d9d9d5}to send a quick reply.");
format(iStr, sizeof(iStr), "(( PM sent %s(%d): %s ))", RPName(iPlayer), iPlayer, iText);
SendClientMessage(playerid, 0xFF66FFAA, iStr);
format( iStr, sizeof(iStr), "13[PM] (( %s(%d) to %s(%d): %s ))",PlayerName(playerid), playerid, PlayerName(iPlayer), iPlayer, iText);
iEcho( iStr );
PlayerLoop(i)
{
if(PlayerTemp[i][adminspy] == 1)
{
format(iStr, sizeof(iStr), "(/pm) %s to %s: %s", PlayerName(playerid), PlayerName(iPlayer), iText);
SendClientMessage(i, COLOR_LIGHTGREY, iStr);
}
}
PlayerTemp[iPlayer][lastpm] = playerid;
if(iAFKp[iPlayer] > 3)
{
format(iStr, sizeof(iStr),"%s is currently AFK",RPName(iPlayer));
SendClientMessage(playerid, COLOR_GREY, iStr);
}
return 1;
}
Re: Command Help -
ball - 18.01.2015
Show command /togpm
Re: Command Help - Diti1 - 18.01.2015
here is but i mean /blockpm [playerid]
PHP код:
COMMAND:togpm(playerid, params[])
{
if(GetPVarInt(playerid, "togPM") == 1)
{
SetPVarInt(playerid, "togPM", 0);
SendClientInfo(playerid, "You have enabled private messaging.");
}
else
{
SetPVarInt(playerid, "togPM", 1);
SendClientInfo(playerid, "You have disabled private messaging. You cannot use /pm anymore.");
}
return 1;
}
Re: Command Help -
nezo2001 - 18.01.2015
Very easy just make a bool
PHP код:
new bool:pm[MAX_PLAYERS];
And at the pm command
PHP код:
if(pm[iPlayer]== false) return SendClientMessage(playerid, -1, "This player blocked private messages"):
And for the command
PHP код:
CMD:pms(playerid, params[])
{
if(pm[playerid] == false)
{
pm[playerid] = true;
SendClientMessage(playerid,0xEE128960,"Private Messages unblocked! You can receive messages from other players");
}
else
{
pm[playerid] = false;
SendClientMessage(playerid, 0xEE128960,"Private Messages blocked! You will no longer receive messages from other players");
}
return 1;
}
Re: Command Help - Diti1 - 18.01.2015
is this /blockpm [playerid] ?
Re: Command Help -
CharlieSanchez - 18.01.2015
Hi Here is an example of one of of my pm systems , however i would say this is just for you to get some ideas and how to use the code , for yourself, so its up to you but i hope it helps dude..
Код:
// You will need to use enums in your player info but this is just an example of what you can do...
enum PlayerInfo
{
//====== Pm system -==/
Last,
PM,
NoPM,
//==================//
}
CMD:pm(playerid, params[])
{
new pID, text[256], string[256];
if(sscanf(params, "us[256]", pID, text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /pm (nick/id) (message) - Enter a valid Nick / ID");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected.");
if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot PM yourself.");
format(string, sizeof(string), "%s (%d) is not accepting private messages at the moment.", PlayerName(pID), pID);
if(pInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "PM to %s: %s", PlayerName(pID), text);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "PM from %s: %s", PlayerName(playerid), text);
SendClientMessage(pID, COLOR_YELLOW, string);
pInfo[pID][Last] = playerid;
for (new i = 0; i < MAX_PLAYERS; i++)
if(pInfo[i][pLevel] >= 6) // Here use your Admin system Enum's
{
format(string, sizeof(string), "PM: %s(%d) to %s(%d): %s", PlayerName(playerid), playerid, PlayerName(pID), pID, text);
{
if(pInfo[i][pLevel] >= 6)
SendClientMessage(i, COLOR_GREY, string);
}
}
return 1;
}
CMD:reply(playerid, params[])
{
new text[256], string[256];
if(sscanf(params, "s[256]", text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /reply (message) - Enter your message");
new pID = pInfo[playerid][Last];
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected.");
if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot PM yourself.");
format(string, sizeof(string), "%s (%d) is not accepting private messages at the moment.", PlayerName(pID), pID);
if(pInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "PM to %s: %s", PlayerName(pID), text);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "PM from %s: %s", PlayerName(playerid), text);
SendClientMessage(pID, COLOR_YELLOW, string);
pInfo[pID][Last] = playerid;
for (new i = 0; i < MAX_PLAYERS; i++)
if(pInfo[i][pLevel] >= 6)
{
format(string, sizeof(string), "PM: %s(%d) to %s(%d): %s", PlayerName(playerid), playerid, PlayerName(pID), pID, text);
{
if(pInfo[i][pLevel] >= 6)
SendClientMessage(i, COLOR_GREY, string);
}
}
return 1;
}
CMD:r(playerid, params[]) return cmd_reply(playerid, params);
CMD:toggpm(playerid, params[])
{
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
if(pInfo[playerid][NoPM] == 1)
{
SendClientMessage(playerid, COLOR_DARK_GREEN, "You Enabled your Private Messages!");
pInfo[playerid][NoPM] = 0;
}
else if(pInfo[playerid][NoPM] == 0)
{
SendClientMessage(playerid, COLOR_RED, "You've already Enabled your Private Messages!");
}
return 1;
}
CMD:nopm(playerid, params[])
{
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
if(pInfo[playerid][NoPM] == 0)
{
SendClientMessage(playerid, COLOR_DARK_GREEN, "You Disabled your Private Message!");
pInfo[playerid][NoPM] = 1;
}
else if(pInfo[playerid][NoPM] == 1)
{
SendClientMessage(playerid, COLOR_RED, "You've already Disabled your Private Message!");
}
return 1;
}
Re: Command Help -
nezo2001 - 19.01.2015
Quote:
Originally Posted by Diti1
is this /blockpm [playerid] ?
|
This is a switch between the two if you used it it will block your pm if you used it again it will unblock.
Re: Command Help - Diti1 - 19.01.2015
But i need other not like that blockpm playerid
Re: Command Help -
ball - 19.01.2015
And your code doesn't work? I think it should, I didn't test but looks good. Try use normal variables instead of PVars.
Re: Command Help -
nezo2001 - 19.01.2015
Try as i said to use bool not PVars as ball said.