[HELP]dcmd command
#1

This is my dcmd command.
But when i do /setteam cad, the textdrawstring is not changing.
Код:
dcmd_setteam(playerid, params[])
	{
  if(!strlen(params))
  {
	TextDrawSetString(Textdraw1, params);
	TextDrawShowForAll(Textdraw1);
	}
	return 1;
	}
Reply
#2

I presume you have the call in onplayercommandtext?\

...
dcmd(setteam, 7, cmdtext);
Reply
#3

Quote:
Originally Posted by mansonh
I presume you have the call in onplayercommandtext?\

...
dcmd(setteam, 7, cmdtext);
Yes
Reply
#4

You gotta destroy and recreate a text draw to change it.
Reply
#5

Actually wait i think your code has an error:
Код:
dcmd_setteam(playerid, params[])
	{
  if(strlen(params)) <---- having the ! meant if you had anything there it wouldn't set it
  {
	TextDrawSetString(Textdraw1, params);
	TextDrawShowForAll(Textdraw1);
	}
	return 1;
	}
You probably also want to use sscanf in order to get the parameters out of params, although aslong as you only type one string i think it might be ok, not sure.

so
pawn Код:
dcmd_setteam(playerid, params[])
    {
new tmp[128];
  if(!sscanf(params,"s",tmp))
  {
    TextDrawSetString(Textdraw1, tmp);
    TextDrawShowForAll(Textdraw1);
    }
    return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)