Major zcmd issue
#1

So, I've just realized that any command that I made that involved more then just "/command" do not work properly. It is not reading past the "/command"

for instance my /pm

it only reads "/pm" so anything like the playerid, and the message after /pm do not get seen and it just seens a message to myself and it is blank.

how can I fix this?

CMD: pm(playerid,params[])

thats how the start looks.. I would really appreciate if someone could help me!!!
Reply
#2

Код:
cmd(pm, playerid, params[])
{
    new targetid, message[128];
    if(sscanf(params, "us", targetid, message))
        return SendClientMessage(playerid, -1, "USAGE: /pm [playerid] [message]");

   if(!IsPlayerConnected(targetid))
        return SendClientMessage(playerid, -1, "Error: Player is offline.");

    new str1[128], str[128], sender[MAX_PLAYER_NAME], receiver[MAX_PLAYER_NAME]
    GetPlayerName(targetid, receiver, sizeof(receiver));
    GetPlayerName(playerid, sender, sizeof(sender));
    format(str1, sizeof(str1), "PM to %s(%d): %s", receiver, targetid, message);
    format(str2, sizeof(str2), "PM from %s(%d): %s", sender, playerid, message);
    SendClientMessage(playerid, -1, str1);
    SendClientMessage(targetid, -1, str2);
    return 1;
}
I am on my ipod, so indentation might be screwed.
and i am using sscanf in this example.
note that i am also new to scripting, miatakes may have been made.
edit; fixed some errors
Reply
#3

Quote:

CMDm(playerid,params[])
{
new PID;
new message;
if(sscanf(params, "us[32]", message))
{
return SendClientMessage(playerid, 0xAFAFAFAA, "USAGE: /pm <playerid> <message>");
}
if(!IsPlayerConnected(PID))
return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player is not connected!");

new pmsg[256];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
format(pmsg,sizeof(pmsg),"PM from %s(%d): %s",pname,playerid,message);

new pidmsg[256];
new pidname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pidname,sizeof(pidname));
format(pidmsg,sizeof(pidmsg),"PM to %s(%d): %s",pidname,PID,message);
SendClientMessage(PID, 0xFFFF00AA, pmsg);
SendClientMessage(playerid, 0xFFFF00AA, pidmsg);
return 1;
}

This is how mine is
Reply
#4

pawn Код:
CMD:test(playerid, params[])
{
    if(!isnull(params)) printf("%i typed %s", playerid, params);
    return 1;
}
Does that display the print with what you typed?


Quote:
Originally Posted by Kurtis96z
Посмотреть сообщение
So, I've just realized that any command that I made that involved more then just "/command" do not work properly. It is not reading past the "/command"
Reply
#5

Put if(sscanf(params, "us[32]", PID, message))
You dont have PID there
Reply
#6

Quote:
Originally Posted by [ABK]Antonio
Посмотреть сообщение
pawn Код:
CMD:test(playerid, params[])
{
    if(!isnull(params)) printf("%i typed %s", playerid, params);
    return 1;
}
Does that display the print with what you typed?
Just tried that and no it did not.
Reply
#7

If you're still having trouble, go copy my code example and replace yours.
Tell me how that goes.
Reply
#8

Quote:
Originally Posted by cosbraa
Посмотреть сообщение
If you're still having trouble, go copy my code example and replace yours.
Tell me how that goes.
I did that and it changed nothing, it has something to do with zcmd or where I am putting all these commands I think.

They are all at the very bottom of my gamemode, where should they be?
Reply
#9

It doesn't matter where you put hem in the script, they are public functions.

Post your PM command and we can see if your doing something wrong.
Reply
#10

Quote:
Originally Posted by Kurtis96z
Посмотреть сообщение
Just tried that and no it did not.
It prints in the server log, you do realize that?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)