[/togpm] Cmd - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [/togpm] Cmd (
/showthread.php?tid=483937)
[/togpm] Cmd -
PrinceOfPersia - 28.12.2013
Hello
Can you make for me the cmd for /togpm
So the player can close his pm while roleplaying
When he /tog pm it says
"You've togged off your private messages"
When someone try to pm him says
"That player is currently togged off his private messages"
Re: [/togpm] Cmd -
PrivatioBoni - 28.12.2013
I'll give you some instructions but won't make it for you.
I'm sure you know what y_ini and enums look like.
You need to create an enum for toggled PMs. So, for example, pPMsToggled.
When you type /togpm, the value of pPMsToggled = 1.
A "SendClientMessage" says "You've toggled off your private messages"
When someone tries to /pm a user whose enum for pPMsToggled == 1, then it will SendClientMessage to playerid saying "That player is currently togged off his private messages"
I feel I've given you quite a lot of help but if you need more, please ask. But you'll need to say whether you're using ZCMD or not etc.
Re: [/togpm] Cmd -
J4mmyHD - 28.12.2013
pawn Код:
// top of script
new PmTogged[MAX_PLAYERS];
// On player connect
PmTogged[playerid] = 0;
// on player command (this is zcmd)
CMD:togpm(playerid, params[])
{
if(PmTogged[playerid] == 1)
{
// message here
PmTogged[playerid] = 0;
}
else
{
// message here
PmTogged[playerid] = 1;
}
return 1;
}
// in the PM command
if(PmTogged[target] == 1) return SendClientMessage(playerid, COLOR_GREY, "Persons PMs are Off");
Re: [/togpm] Cmd -
erminpr0 - 28.12.2013
pawn Код:
static bool: gPrivMsgTog[MAX_PLAYERS char];
public OnPlayerConnect(playerid)
{
gPrivMsgTog{playerid} = true;
return 1;
}
YCMD:togglepm(playerid, params[], help)
{
#pragma unused params
#pragma unused help
if(gPrivMsgTog{playerid}) return gPrivMsgTog{playerid} = false;
gPrivMsgTog{playerid} = true;
}
YCMD:pm(playerid, params[], help)
{
#pragma unused help
new player, text[0b10000000-MAX_PLAYER_NAME-0xA];
if(sscanf(params, "us[94]", player, text))
return SendClientMessage(playerid, -1, "Usage: /pm [playerid/PartOfName]");
if(INVALID_PLAYER_ID == player || player == playerid)
return 1;
if(!gPrivMsgTog{player}) return 1;
new pName[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME];
GetPlayerName(player, pName, 0x18);
GetPlayerName(playerid, sendername, 0b11000);
new string[0x80];
format(string, sizeof string, "PM from %s: %s", sendername, text);
SendClientMessage(player, -1, string);
format(string, sizeof string, "PM to %s: %s", pName, text);
return SendClientMessage(playerid, -1, string);
}