[FilterScript] PM System - 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: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] PM System (
/showthread.php?tid=490588)
PM System -
boomerboom - 27.01.2014
PM system
Commands:
/pm
/nopm
/r[eply] [text]
Filterscript requires:
DCMD
sscanf
Link: Pastenbin
Credits:
-boomerboom[me] for filterscript
-
Dracoblue for DCMD
-
****** for sscanf
Re: PM System -
kN1GhT - 27.01.2014
Why are u still using dcmds when faster processors are available
Re: PM System -
boomerboom - 27.01.2014
Quote:
Originally Posted by kN1GhT
Why are u still using dcmds when faster processors are available
|
I like DCMD.
Re: PM System -
Konstantinos - 27.01.2014
command /pm:
pawn Код:
new pID, text[128], string[128];
if(sscanf(params, "us", pID, text)) return SendClientMessage(playerid, COLOR_RED, "{0x0000BBAA}[Usage]:{8B8B8B}Use /pm [ID] [Message] .");
Declaring string when the usage might be wrong and never used is pointless. It's better do it after the sscanf line. "s" specifier needs the size otherwise it's 32 by default.
pawn Код:
format(string, sizeof(string), "{0x0000BBAA}[System]:{8B8B8B} %s is not accepting any private mesages at the moment (%d)", PlayerName(pID), pID);
if(pInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, string);
In case the NoPM is 0, you've called format function without a valid reason (pointless again). It's better to check if it's 1 and format/send the message.
command /r:
pawn Код:
new text[128], string[128];
if(sscanf(params, "s", text)) return SendClientMessage(playerid, COLOR_RED, "{0x0000BBAA}[Usage]:{8B8B8B} /r[reply] [Message]");
You've declared 2 arrays when one only can be used and not being declared before like we said above. You can use params for storing the text.
pawn Код:
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "{0x0000BBAA}[Usage]:{8B8B8B} /r[reply] [Message]");
and the isnull macro:
pawn Код:
#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
---
pawn Код:
format(string, sizeof(string), "{0x0000BBAA}[System]:{8B8B8B} %s is not accepting any private mesages at the moment (%d", PlayerName(pID), pID);
if(pInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, string);
The same as the above command.
reply would have 5, but since you changed it to "/r", use 1.
Re: PM System -
boomerboom - 27.01.2014
Quote:
Originally Posted by Konstantinos
command /pm:
pawn Код:
new pID, text[128], string[128]; if(sscanf(params, "us", pID, text)) return SendClientMessage(playerid, COLOR_RED, "{0x0000BBAA}[Usage]:{8B8B8B}Use /pm [ID] [Message] .");
Declaring string when the usage might be wrong and never used is pointless. It's better do it after the sscanf line. "s" specifier needs the size otherwise it's 32 by default.
pawn Код:
format(string, sizeof(string), "{0x0000BBAA}[System]:{8B8B8B} %s is not accepting any private mesages at the moment (%d)", PlayerName(pID), pID); if(pInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, string);
In case the NoPM is 0, you've called format function without a valid reason (pointless again). It's better to check if it's 1 and format/send the message.
command /r:
pawn Код:
new text[128], string[128]; if(sscanf(params, "s", text)) return SendClientMessage(playerid, COLOR_RED, "{0x0000BBAA}[Usage]:{8B8B8B} /r[reply] [Message]");
You've declared 2 arrays when one only can be used and not being declared before like we said above. You can use params for storing the text.
pawn Код:
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "{0x0000BBAA}[Usage]:{8B8B8B} /r[reply] [Message]");
and the isnull macro:
pawn Код:
#if !defined isnull #define isnull(%1) \ ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1])))) #endif
---
pawn Код:
format(string, sizeof(string), "{0x0000BBAA}[System]:{8B8B8B} %s is not accepting any private mesages at the moment (%d", PlayerName(pID), pID); if(pInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, string);
The same as the above command.
reply would have 5, but since you changed it to "/r", use 1.
|
Thank you for suggestions...I like my shitty scripting way, anyways.
But thank you