last thing ... - 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: last thing ... (
/showthread.php?tid=198934)
last thing ... -
blackwave - 13.12.2010
I'm trying to make a character on OnPlayerText become a command, for type:
Instead
here:
pawn Код:
if(text[0] == '&')
{
OnPlayerCommandText(playerid, "/x");
return 0;
}
And when I type, just shows the character:
PS: My command chose is on dcmd, but I already tried with a command on OnPlayerCommandText, and doesn't works. Any Idea?
Re: last thing ... -
JaTochNietDan - 13.12.2010
Well you're not passing anything to it, all your send to OnPlayerCommandText is "/x"...there's no text or anything, you need some formatting.
pawn Код:
if(text[0] == '&')
{
new string[128];
format(string,sizeof(string),"/x %s",text);
OnPlayerCommandText(playerid, "/x");
return 0;
}
Why do you pass it through OnPlayerCommandText anyway? Couldn't you just do:
pawn Код:
if(text[0] == '&')
{
new string[128];
format(string,sizeof(string),"Chat: %s",text);
SendClientMessageToAll(red,string);
return 0;
}
Re: last thing ... -
blackwave - 13.12.2010
Quote:
Originally Posted by JaTochNietDan
Well you're not passing anything to it, all your send to OnPlayerCommandText is "/x"...there's no text or anything, you need some formatting.
pawn Код:
if(text[0] == '&') { new string[128]; format(string,sizeof(string),"/x %s",text); OnPlayerCommandText(playerid, "/x"); return 0; }
Why do you pass it through OnPlayerCommandText anyway? Couldn't you just do:
pawn Код:
if(text[0] == '&') { new string[128]; format(string,sizeof(string),"Chat: %s",text); SendClientMessageToAll(red,string); return 0; }
|
Since I fixed the command /x 100%, I transfered the command for the:
And now that's ok:
pawn Код:
new string[128],name[30];
if(text[0] == '&')
{
GetPlayerName(playerid, name, 30);
format(string, sizeof(string), "CHAT: %s [ID: %d]: %s", name, playerid, text[1]);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPlayerTeam(playerid) == GetPlayerTeam(i))
{
SendClientMessage(i,agua,string);
return 0;
}
}
return 0;
}
thx