if player types "1" in chat - 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: if player types "1" in chat (
/showthread.php?tid=153871)
if player types "1" in chat -
jamesbond007 - 11.06.2010
how to find out if a player types 1 in chat without the / before the 1
cause i have a text draw for buying weapons and i need to find out which weapon the player wants
Re: if player types "1" in chat -
WardenCS - 11.06.2010
you mean command without /?,just dont add / then?
Код:
if (strcmp("1", cmdtext, true, 10) == 0)//if he types 1
{
// then there will happen
return 1;
}
Re: if player types "1" in chat -
ViruZZzZ_ChiLLL - 11.06.2010
Try this :
pawn Код:
if(text[0] == '1')
{
// do something here
return 1;
}
Re: if player types "1" in chat -
jamesbond007 - 11.06.2010
Quote:
Originally Posted by Fog™
you mean command without /?,just dont add / then?
Код:
if (strcmp("1", cmdtext, true, 10) == 0)//if he types 1
{
// then there will happen
return 1;
}
|
why did you put 10 after true? isnt it suppose to be 1 because "1" is only one character or what?
Re: if player types "1" in chat -
WardenCS - 11.06.2010
oops xd
Re: if player types "1" in chat -
jamesbond007 - 11.06.2010
HELP PLS!!
Re: if player types "1" in chat -
DJDhan - 11.06.2010
Quote:
Originally Posted by ViruZZzZ_ChiLLL
Try this :
pawn Код:
if(text[0] == '1') { // do something here return 1; }
|
This should work. Put it under OnPlayerText(playerid,text[]) function
Re: if player types "1" in chat -
Niixie - 11.06.2010
Use the one ViruZZzZ_ChiLLL made,
Quote:
Originally Posted by ViruZZzZ_ChiLLL
pawn Код:
if(text[0] == '1') { // do something here return 1; }
|
Because, thats better than the one Fog made
Quote:
Originally Posted by Fog™
you mean command without /?,just dont add / then?
Код:
if (strcmp("1", cmdtext, true, 10) == 0)//if he types 1
{
// then there will happen
return 1;
}
|
Re: if player types "1" in chat -
jamesbond007 - 11.06.2010
thank you both ! your awesome man