dcmd problem with 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: dcmd problem with command. (
/showthread.php?tid=93087)
dcmd problem with command. -
[mad]MLK - 23.08.2009
hey i get the following errors:
Код:
C:\Users\user\Desktop\SA-MP Server Unreal Stuntages\Stunt City\gamemodes\testdcmd.pwn(728) : warning 219: local variable "pname" shadows a variable at a preceding level
C:\Users\user\Desktop\SA-MP Server Unreal Stuntages\Stunt City\gamemodes\testdcmd.pwn(730) : error 017: undefined symbol "cmdtext"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
this is my code:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(test, 4, cmdtext);
dcmd(seafun, 6, cmdtext);
return 0;
}
dcmd_test(playerid, params[])
{
#pragma unused params
new pname[24], string[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s is PRO!", pname);
SendClientMessage(playerid, 0x00FF00AA, "this was a test");
SendClientMessageToAll(0x00FF00AA, string);
{
TextDrawShowForAll(Textdraw10);
new pname[24];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s has gone to %s", pname, cmdtext);
Textdraw10 = TextDrawCreate(202.000000,4.000000, string);
TextDrawAlignment(Textdraw10,0);
TextDrawBackgroundColor(Textdraw10,0x000000ff);
TextDrawFont(Textdraw10,3);
TextDrawLetterSize(Textdraw10,0.399999,1.300000);
TextDrawColor(Textdraw10,0xff0000ff);
TextDrawSetOutline(Textdraw10,1);
TextDrawSetProportional(Textdraw10,1);
TextDrawSetShadow(Textdraw10,1);
}
return 1;
}
dcmd_seafun(playerid, params[])
{
#pragma unused params
SetPlayerPos(playerid, 2450.2224, -1788.5258, 458.3834);
new pname[24], string[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "[Teleport] %s Has gone to /seafun", pname);
SendClientMessage(playerid, 0x00FF00AA, "You have teleported to seafun.");
SendClientMessageToAll(0x00FF00AA, string);
return 1;
}
Line 728:
Line 730:
Код:
format(string, sizeof(string), "%s has gone to %s", pname, cmdtext);
any help?
Re: dcmd problem with command. -
ronyx69 - 23.08.2009
Just delete line 728.
And about that format - i don't know, but i think dcmd doesn't output cmdtext or something like that. So you will just need to put there /test, not cmdtext.
Re: dcmd problem with command. -
[mad]MLK - 23.08.2009
arg thats gona take some time because i want it so that every time a player types a command it shows at the top of the screen but i did do it one way without putting the textdraw in every cmd but it was keep overlaping everytime someone typed a cmd