Posts: 413
Threads: 59
Joined: Sep 2013
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