Major zcmd issue -
Kurtis96z - 03.06.2012
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!!!
Re: Major zcmd issue -
cosbraa - 03.06.2012
Код:
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
Re: Major zcmd issue -
Kurtis96z - 03.06.2012
Quote:
CMD m(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
Re: Major zcmd issue -
[ABK]Antonio - 03.06.2012
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"
|
Re: Major zcmd issue -
cosbraa - 03.06.2012
Put if(sscanf(params, "us[32]", PID, message))
You dont have PID there
Re: Major zcmd issue -
Kurtis96z - 03.06.2012
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.
Re: Major zcmd issue -
cosbraa - 03.06.2012
If you're still having trouble, go copy my code example and replace yours.
Tell me how that goes.
Re: Major zcmd issue -
Kurtis96z - 03.06.2012
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?
Re: Major zcmd issue -
iggy1 - 03.06.2012
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.
Re: Major zcmd issue -
milanosie - 03.06.2012
Quote:
Originally Posted by Kurtis96z
Just tried that and no it did not.
|
It prints in the server log, you do realize that?