Simple RP script issue -
nmader - 21.11.2011
Alright, so I got a bit of help, originally this was a Wiki /me script, but I edited it to what I thought would work:
Should look somewhat like this IG.
Eating ((Nathan Mader)) when I type /do, but instead it has been looking like: [b]/do Eating ((an_Mader))
pawn Код:
if(!strcmp(cmdtext, "/do", true, 3)) // 3 is the length of /me
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /do [action]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "%s ((%s))", cmdtext, str[4]);
SendClientMessageToAll(0xC2A2DAAA, str);
return 1;
}
So, if someone could help me, it would be greatly appreciated, thank you all!
Re: Simple RP script issue -
Calgon - 21.11.2011
pawn Код:
format(str, sizeof(str), "%s ((%s))", cmdtext[3], str);
Remove the '[4]', that's to get the number of characters in to a string and onwards. And add the '[3]'.
Also, the wiki isn't wikipedia.
Re: Simple RP script issue -
nmader - 21.11.2011
Quote:
Originally Posted by Calgon
pawn Код:
format(str, sizeof(str), "%s ((%s))", cmdtext, str);
Remove the '[4]', that's to get the number of characters in to a string and onwards.
Also, the wiki isn't wikipedia.
|
I will try it now
Whatever, same thing to me... edited it anyways
Re: Simple RP script issue -
Camacorn - 21.11.2011
pawn Код:
if(!strcmp(cmdtext, "/do", true, 3)) // 3 is the length of /me
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /do [action]");
new str[128];
GetPlayerName(playerid, str, 25);
format(str, sizeof(str), "%s ((%s))", cmdtext, str);
SendClientMessageToAll(0xC2A2DAAA, str);
return 1;
}
Try this.
- Camacorn
Re: Simple RP script issue -
nmader - 21.11.2011
Thank you both, you have progressed it, yet it still shows /do in front of what I want.
I.E.
/do Eats ((Nathan_Mader)) it adds the /do to what I type.
Re: Simple RP script issue -
Jack_Leslie - 21.11.2011
EDIT:
It's saying /do because "/do" is apart of cmdtext.
Replace cmdtext with result.
Add this above all your coding:
pawn Код:
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "{CC1100}USAGE: {FFFFFF} /do [local chat]");
return 1;
}