Dcmd problem
#1

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

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

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.
Reply
#4

Show the command?
Reply
#5

Did you put the:
pawn Код:
#include <dcmd>
uptop?
Reply
#6

Show the code or test if you have got 4 charachars

like this

pawn Код:
dcmd(kill,4,cmdtext);
Reply
#7

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;
}
Reply
#8

So you mean you got it wroking or what?
Reply
#9

no, the code should work, but unknown command ingame...
Reply
#10

bump, still got the problem...
Reply
#11

what does OnPlayerCommandText return (1 or 0)?
Reply
#12

1 and then 0
Reply
#13

bump, still got the problem...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)