/o command by me not working well! -
ricardo178 - 26.03.2011
Hey guys, my /o command isn't working very well....
If i just type /o it could say USAGE: /o [Text] and it show: [OOC] Ricardo_Manuel say: z
amd if i type /o test it show:[OOC] Ricardo_Manuel say: z and after show UnknownCommand
Please help me!
Re: /o command by me not working well! -
Jochemd - 26.03.2011
Probably you have used %d in stead of %s or your string is too low
Re: /o command by me not working well! -
iJumbo - 26.03.2011
show the code so we can understand better your proplem
Re: /o command by me not working well! -
SchurmanCQC - 26.03.2011
Your sscanf code could be fucked. (messed up)
Re: /o command by me not working well! -
ricardo178 - 26.03.2011
Code here(o forgeted on first post...
pawn Код:
COMMAND:o(playerid, params[])
{
new text;
if(!sscanf(params, "z", text))
{
new name[MAX_PLAYER_NAME], string[64];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[OOC]%s say: %z ", name, text);
SendClientMessageToAll(0xFFFFFF, string);
return 1;
}
else return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /o [Text]");
}
Re: /o command by me not working well! -
Jochemd - 26.03.2011
Use %s in stead of %z
pawn Код:
COMMAND:o(playerid, params[])
{
new text;
if(!sscanf(params, "s", text))
{
new name[MAX_PLAYER_NAME], string[64];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[OOC]%s say: %s ", name, text);
SendClientMessageToAll(0xFFFFFF, string);
return 1;
}
else return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /o [Text]");
}
Re: /o command by me not working well! -
iJumbo - 26.03.2011
pawn Код:
COMMAND:o(playerid, params[])
{
new text[127];
if(!sscanf(params, "s", text))
{
new name[MAX_PLAYER_NAME], string[64];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[OOC]%s say: %s ", name, text);
SendClientMessageToAll(0xFFFFFF, string);
return 1;
}
else return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /o [Text]");
}
Re: /o command by me not working well! -
Zh3r0 - 26.03.2011
Quote:
Originally Posted by [ISS]jumbo
pawn Код:
COMMAND:o(playerid, params[]) { new text[127]; if(!sscanf(params, "s", text)) { new name[MAX_PLAYER_NAME], string[64]; GetPlayerName(playerid, name, sizeof(name)); format(string, sizeof(string), "[OOC]%s say: %s ", name, text); SendClientMessageToAll(0xFFFFFF, string); return 1; } else return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /o [Text]"); }
|
If he uses the plugin, an array size must be added near the 's' .
pawn Код:
if ( !sscanf( params, "s[127]", text ) )
Re: /o command by me not working well! -
leong124 - 26.03.2011
pawn Код:
COMMAND:o(playerid, params[])
{
new text[129];
if(!sscanf(params, "s[128]", text))//z is optional string so null string is still valid
{
new name[MAX_PLAYER_NAME];//To save memory, you don't need to use another string.
GetPlayerName(playerid, name, sizeof(name));
format(text, sizeof(text), "[OOC]%s say: %s ", name, text);//There's no %z in format.Only in sscanf.
//Use the same string here is okay
SendClientMessageToAll(0xFFFFFF, string);//Do you need white colour or cyan?The colour is 32-bit here.
return 1;
}
else return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /o [Text]");//Same as above
}
Re: /o command by me not working well! -
Zh3r0 - 26.03.2011
Quote:
Originally Posted by leong124
pawn Код:
COMMAND:o(playerid, params[]) { new text[129]; if(!sscanf(params, "s[128]", text))//z is optional string so null string is still valid { new name[MAX_PLAYER_NAME], string[64]; GetPlayerName(playerid, name, sizeof(name)); format(string, sizeof(string), "[OOC]%s say: %s ", name, text);//There's no %z in format.Only in sscanf. SendClientMessageToAll(0xFFFFFF, string);//Do you need white colour or cyan?The colour is 32-bit here. return 1; } else return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /o [Text]");//Same as above }
|
If the Alpha isn't set it will automatically be set to FF. as far as i know.