11.10.2012, 18:18
Hello everyone. I made some chat commands, but i have some problems with them! Here i'll show you screenshots of the issue, and i'll post the pawno codes for those who might be able to fix it
Problem Screenshots:
Problem Codes:
1. /do
2. /me
3. /b
4. /o
I hope someone is able to fix it !
Greetings, CrazyManiac.
NOTE: When i type a chat command followed by text (Example: /me takes a shit), it says Unknown Command.
NOTE: For those who were gonna ask if i have sscanf, i do.
Problem Screenshots:
Problem Codes:
1. /do
Код:
if (strcmp("/do", cmdtext, true, 10) == 0) { new str[128]; if(sscanf(cmdtext,"s[128]",str)) return SendClientMessage(playerid,-1,"USAGE: /do [TEXT]"); new name[20]; GetPlayerName(playerid,name,20); format(str,sizeof(str),"** %s ((%s))",str,name); new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid,X,Y,Z); for(new i = 0;i<MAX_PLAYERS;++i) { if(IsPlayerInRangeOfPoint(i,5,X,Y,Z)) SendClientMessage(i,-1,str); return 0; } return 1; }
Код:
if (strcmp("/me", cmdtext, true, 10) == 0) { new str[128]; if(sscanf(cmdtext,"s[128]",str)) return SendClientMessage(playerid,-1,"USAGE: /me [TEXT]"); new name[20]; GetPlayerName(playerid,name,20); format(str,sizeof(str),"** %s %s **",name,str); new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid,X,Y,Z); for(new i = 0;i<MAX_PLAYERS;++i) { if(IsPlayerInRangeOfPoint(i,5,X,Y,Z)) SendClientMessage(i,-1,str); return 0; } return 1; }
Код:
if (strcmp("/b", cmdtext, true, 10) == 0) { new str[128]; if(sscanf(cmdtext,"s[128]",str)) return SendClientMessage(playerid,-1,"USAGE: /b [TEXT]"); new name[20]; GetPlayerName(playerid,name,20); format(str,sizeof(str),"((%s: %s))",name,str); new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid,X,Y,Z); for(new i = 0;i<MAX_PLAYERS;++i) { if(IsPlayerInRangeOfPoint(i,5,X,Y,Z)) SendClientMessage(i,-1,str); return 0; } return 1; }
Код:
if (strcmp("/o", cmdtext, true, 10) == 0) { new str[128]; if(sscanf(cmdtext,"s[128]",str)) return SendClientMessage(playerid,-1,"USAGE: /o [TEXT]"); new name[20]; GetPlayerName(playerid,name,20); format(str,sizeof(str),"[OOC] %s[%d]: %s",name,playerid,str); SendClientMessageToAll(-1,str); return 1; }
Greetings, CrazyManiac.
NOTE: When i type a chat command followed by text (Example: /me takes a shit), it says Unknown Command.
NOTE: For those who were gonna ask if i have sscanf, i do.
Код:
#include <sscanf2>