SA-MP Forums Archive
Whats wrong with this ? - 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: Whats wrong with this ? (/showthread.php?tid=263997)



Whats wrong with this ? - Jay. - 24.06.2011

Hi. I have made this:

pawn Код:
dcmd_news(playerid,params[])
{   if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_WHITE, "SERVER: Unknown command.");
    {
       if(!strlen(params)) return SendClientMessage(playerid,COLOR_RED,"Usage: /news [text]");
       if(strlen(params) >30) return SendClientMessage(playerid,COLOR_RED,"You can only use a maximun of 30 charactors!");
       if(strfind(params,"/") != -1 || strfind(params,":")!= -1 || strfind(params,"?")!= -1 || strfind(params,"<")!= -1 || strfind(params,">")!= -1 ||
       strfind(params,"|")!= -1 || strfind(params,"\\")!= -1 || strfind(params,"*") || strfind(params,"\"")!= -1)
       return SendClientMessage(playerid,COLOR_RED,"You can't use these charactors!");
       else
       {
            TextDrawSetString(Textdraw1,params);

       }
       return 1;
   }

}
The problem is , no matter what I type it will return "you can';t use these charactors".

Anyone know the problem?

Oh and also , my friend wanted to ask this question. I tried to tell him myself(in fact, i don't know for sure either)
Textdrawshowforall is not needed with textdrawsetstring ? I don't think so , as 1. it is showing it to all, not just a player. 2. it just sets the text string.

Thanks!


Re: Whats wrong with this ? - Sascha - 24.06.2011

strfind(params,"*") should be "strfind(params, "*") != -1" (as all the rest^^ I guess you simply forgot it there)..
and for the textdraw:
TextDrawSetString does not replace TextDrawShowForAll.
TextDrawSetString will only change the text of the textdraw, however will not make it appear.
TextDrawShowForAll (or TextDrawShowForPlayer) are always used to make them appear.
However: If the textdraw is already visible, you will not need another "TextDrawShowForAll" after using "TextDrawSetString"


Re: Whats wrong with this ? - Jay. - 24.06.2011

Quote:
Originally Posted by Sascha
Посмотреть сообщение
strfind(params,"*") should be "strfind(params, "*") != -1" (as all the rest^^ I guess you simply forgot it there)..
and for the textdraw:
TextDrawSetString does not replace TextDrawShowForAll.
TextDrawSetString will only change the text of the textdraw, however will not make it appear.
TextDrawShowForAll (or TextDrawShowForPlayer) are always used to make them appear.
However: If the textdraw is already visible, you will not need another "TextDrawShowForAll" after using "TextDrawSetString"
Thanks