SA-MP Forums Archive
Changeing A Command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Changeing A Command (/showthread.php?tid=159587)



Changeing A Command - robert4049 - 13.07.2010

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


Re: Changeing A Command - oliverrud - 13.07.2010

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;
        }
    }



Re: Changeing A Command - robert4049 - 13.07.2010

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


Re: Changeing A Command - oliverrud - 13.07.2010

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


Re: Changeing A Command - robert4049 - 13.07.2010

haha wow


Re: Changeing A Command - robert4049 - 13.07.2010

doesnt work


Re: Changeing A Command - robert4049 - 14.07.2010

oops went to edit and accidently hit this sorry mate


Re: Changeing A Command - CuervO - 14.07.2010

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


Re: Changeing A Command - robert4049 - 14.07.2010

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.



Re: Changeing A Command - Dennis - 14.07.2010

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?