if player types "1" in chat
#1

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
Reply
#2

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;
	}
Reply
#3

Try this :
pawn Код:
if(text[0] == '1')
{
 // do something here
 return 1;
}
Reply
#4

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?
Reply
#5

oops xd
Reply
#6

HELP PLS!!
Reply
#7

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
Reply
#8

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;
	}
Reply
#9

thank you both ! your awesome man
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)