Changeing A Command
#1

Okay i need to change a command right now if you do the chat it's " (YOur text here)" and im trying to change it to "/b (your text here)" and it's not working.
Код:
	}
 	new idx;
	tmp = strtok(text, idx);
 	if((strcmp("(", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("(")))
	{
	    if(text[1] != 0)
	    {
		    format(string, sizeof(string), "(( [LOCAL OOC:] %s says: %s ))", PlayerName(playerid),text[1]);
			ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
			OOCLog(string);
	   		return 0;
   		}
	}
Is the orgianl
and the on i modified to work is

Код:
 	new idx;
	tmp = strtok(text, idx);
 	if((strcmp("/b", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("(")))
	{
	    if(text[1] != 0)
	    {
		    format(string, sizeof(string), "(( [LOCAL OOC:] %s says: %s ))", PlayerName(playerid),text[1]);
			ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
			OOCLog(string);
	   		return 0;
   		}
	}
and it doesnt work
Reply
#2

pawn Код:
new idx;
    tmp = strtok(text, idx);
    if((strcmp("/b", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("/")))
    {
        if(text[1] != 0)
        {
            format(string, sizeof(string), "(( [LOCAL OOC:] %s says: %s ))", PlayerName(playerid),text[1]);
            ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
            OOCLog(string);
            return 0;
        }
    }
Reply
#3

okay so that back piece
Код:
 && (strlen(tmp) == strlen("/")))
is defining like how it would be put in. Correct?
Reply
#4

Actually I'm not really sure, I just changed that as that would be the most obvious thing to do :=P
Reply
#5

haha wow
Reply
#6

doesnt work
Reply
#7

oops went to edit and accidently hit this sorry mate
Reply
#8

Onplayercommand text is only called when the character '/' is used at the front of a command. Use onplayertext instead for other characters such '(' or '@'
Reply
#9

okay cause i am wanting to change it to /b for local ooc not the " ("
and i tried this
Код:
	if(strcmp(cmd, "/b", true) == 0)
    {
        if(text[1] != 0)
        {
            format(string, sizeof(string),"(( Local OOC: %s says: %s ))", PlayerName(playerid),text[1]);
            ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
            OOCLog(string);
            return 0;
        }
    }
and i get this error
Код:
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(1546) : error 017: undefined symbol "cmd"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#10

Quote:
Originally Posted by robert4049
Посмотреть сообщение
[/code]
and i get this error
Код:
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(1546) : error 017: undefined symbol "cmd"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Try defining it?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)