Whats wrong with this ?
#1

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!
Reply
#2

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"
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)