Dcmd problem - 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 (
/showthread.php?tid=245240)
Dcmd problem -
Markx - 30.03.2011
Here is the problem:
I make any kind of commands like /kill in dcmd, and when i do /kill ingame it says "SERVER: Unknown command", my code is fine! All should work, can someone help?
Re: Dcmd problem -
kickflipdude - 30.03.2011
why do it there? why not just do this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/kill", cmdtext, true, 10) == 0)
{
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, 0xC2A2DAAA, "You Have Comitted Suicide");
return 1;
}
return 0;
}
Compile! And your done!
Re: Dcmd problem -
Markx - 30.03.2011
Quote:
Originally Posted by kickflipdude
why do it there? why not just do this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/kill", cmdtext, true, 10) == 0) { SetPlayerHealth(playerid, 0); SendClientMessage(playerid, 0xC2A2DAAA, "You Have Comitted Suicide"); return 1; } return 0; }
Compile! And your done!
|
I aint a script begginer, i make a admin script in my gamemode, and the /kill command was just an example. I need the sollution of this.
Re: Dcmd problem -
WillyP - 30.03.2011
Show the command?
Re: Dcmd problem -
kickflipdude - 30.03.2011
Did you put the:
uptop?
Re: Dcmd problem -
xir - 30.03.2011
Show the code or test if you have got 4 charachars
like this
Re: Dcmd problem -
Markx - 30.03.2011
Yes all works, heres a example
pawn Код:
//Under on player command text bla bla
dcmd(kill,4,cmdtext);
//at button
dcmd_kill(playerid, params[])
{
SetPlayerHealth(playerid, 0);
return true;
}
Re: Dcmd problem -
xir - 30.03.2011
So you mean you got it wroking or what?
Re: Dcmd problem -
Markx - 30.03.2011
no, the code should work, but unknown command ingame...
Re: Dcmd problem -
Markx - 30.03.2011
bump, still got the problem...
Re: Dcmd problem -
aircombat - 30.03.2011
what does OnPlayerCommandText return (1 or 0)?
Re: Dcmd problem -
Markx - 30.03.2011
1 and then 0
Re: Dcmd problem -
Markx - 06.04.2011
bump, still got the problem...