Chat Commands
#1

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

Код:
	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;
	}
2. /me

Код:
 	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;
	}
3. /b

Код:
	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;
	}
4. /o

Код:
	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;
	}
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.
Код:
#include <sscanf2>
Reply


Messages In This Thread
Chat Commands - by CrazyManiac - 11.10.2012, 18:18
Re: Chat Commands - by gtakillerIV - 11.10.2012, 18:26
Re: Chat Commands - by CrazyManiac - 11.10.2012, 18:46
Re: Chat Commands - by gtakillerIV - 11.10.2012, 18:54
Re: Chat Commands - by Riddick94 - 11.10.2012, 18:59
Re: Chat Commands - by CrazyManiac - 11.10.2012, 19:13
Re: Chat Commands - by Glint - 11.10.2012, 19:14
Re: Chat Commands - by zSuYaNw - 11.10.2012, 19:21
Re: Chat Commands - by ZeMuNaC - 11.10.2012, 20:17
Re: Chat Commands - by Riddick94 - 11.10.2012, 20:26

Forum Jump:


Users browsing this thread: 2 Guest(s)