SA-MP Forums Archive
[HELP]dcmd 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: [HELP]dcmd command (/showthread.php?tid=123616)



[HELP]dcmd command - deather - 26.01.2010

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



Re: [HELP]dcmd command - mansonh - 26.01.2010

I presume you have the call in onplayercommandtext?\

...
dcmd(setteam, 7, cmdtext);


Re: [HELP]dcmd command - deather - 27.01.2010

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

...
dcmd(setteam, 7, cmdtext);
Yes


Re: [HELP]dcmd command - Kinetic - 27.01.2010

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


Re: [HELP]dcmd command - mansonh - 27.01.2010

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