/o :( - 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: /o :( (
/showthread.php?tid=169279)
/o :( -
Luis- - 19.08.2010
Okay My /o command is bugged but I cannot see anything wrong :/
pawn Код:
if (strcmp("/o", cmdtext, true, 3) == 0)
{
if(!strlen(cmdtext)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /o [chat]");
new str[256];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "[OOC] %s: %s", str, cmdtext);
SendClientMessageToAll(COLOR_GREEN, str);
return 1;
}
When I type /o it just does what is does in the Picture
Re: /o :( -
Toni - 19.08.2010
Quote:
Originally Posted by Luis the Lobster
Okay My /o command is bugged but I cannot see anything wrong :/
pawn Код:
if (strcmp("/o", cmdtext, true, 3) == 0) { if(!strlen(cmdtext)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /o [chat]"); new str[256]; GetPlayerName(playerid, str, sizeof(str)); format(str, sizeof(str), "[OOC] %s: %s", str, cmdtext); SendClientMessageToAll(COLOR_GREEN, str); return 1; }
When I type /o it just does what is does in the Picture
|
you need strtok, which is a small snippet that will get a string/result after space example.
/o' 'message.... ' ' is the space and strtok will get the message after it.
Re: /o :( -
Faith - 19.08.2010
First of all, don't use str[256], view ******' post about code optimizations for more info.
Код:
if (strcmp("/o", cmdtext, true, 2) == 0)
{
if(!strlen(cmdtext)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /o [chat]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "[OOC] %s: %s", str, cmdtext[4]);
SendClientMessageToAll(COLOR_GREEN, str);
return 1;
}
Try that.
Re: /o :( -
Luis- - 19.08.2010
I used Faith code but now it says Luis_Geramia: n123, ?
Re: /o :( -
PotH3Ad - 19.08.2010
Try this:
pawn Код:
if(!strcmp("/o", cmdtext, true, 2))
{
if(!strlen(cmdtext)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /o [chat]");
new str[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(str, sizeof(str), "[OOC] %s: %s", pName, cmdtext[2]);
SendClientMessageToAll(COLOR_GREEN, str);
return 1;
}
Re: /o :( -
Luis- - 19.08.2010
Thanks Pothead