[FilterScript] PM System
#1

PM system



Commands:
/pm
/nopm
/r[eply] [text]




Filterscript requires:
DCMD
sscanf


Link: Pastenbin

Credits:

-boomerboom[me] for filterscript
-Dracoblue for DCMD
-****** for sscanf
Reply
#2

Why are u still using dcmds when faster processors are available
Reply
#3

Quote:
Originally Posted by kN1GhT
Посмотреть сообщение
Why are u still using dcmds when faster processors are available
I like DCMD.
Reply
#4

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.

pawn Код:
dcmd(r, 5, cmdtext);
reply would have 5, but since you changed it to "/r", use 1.
Reply
#5

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.

pawn Код:
dcmd(r, 5, cmdtext);
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)