27.01.2014, 11:06
command /pm:
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.
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:
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.
and the isnull macro:
---
The same as the above command.
reply would have 5, but since you changed it to "/r", use 1.
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] .");
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);
command /r:
pawn Код:
new text[128], string[128];
if(sscanf(params, "s", text)) return SendClientMessage(playerid, COLOR_RED, "{0x0000BBAA}[Usage]:{8B8B8B} /r[reply] [Message]");
pawn Код:
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "{0x0000BBAA}[Usage]:{8B8B8B} /r[reply] [Message]");
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);
pawn Код:
dcmd(r, 5, cmdtext);