SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 22/05/2013, 07:57 PM   #1
HurtLocker
Gangsta
 
HurtLocker's Avatar
 
Join Date: Dec 2012
Location: Hellas, Thessaloniki
Posts: 569
Reputation: 29
Default how to compare string cell to character?

I want to make this check (detect if player enters command):
pawn Code:
if(text[0]=='/')
I tried exactly the code above, gets compiled but has no effect.
__________________
Join Fallout's Best TDM server ever!
Useful command: Sounds finder
Turotial: Making a textdraw without editors
HurtLocker is offline   Reply With Quote
Old 22/05/2013, 08:00 PM   #2
Richie©
Banned
 
Join Date: Feb 2012
Location: Norway
Posts: 381
Reputation: 53
Default Re: how to compare string cell to character?

You can use strfind for that.
http://wiki.sa-mp.com/wiki/Strfind
Richie© is offline   Reply With Quote
Old 22/05/2013, 08:04 PM   #3
HurtLocker
Gangsta
 
HurtLocker's Avatar
 
Join Date: Dec 2012
Location: Hellas, Thessaloniki
Posts: 569
Reputation: 29
Default AW: how to compare string cell to character?

Quote:
Originally Posted by Richie© View Post
You can use strfind for that.
http://wiki.sa-mp.com/wiki/Strfind
This is not what I asked. Title is pretty clear I think.

******: Yes, I used it under onplayertext. Now what?
EDIT: I go test it under OnPlayerCommandText

EDIT: damn, same thing. What can I do now?
__________________
Join Fallout's Best TDM server ever!
Useful command: Sounds finder
Turotial: Making a textdraw without editors
HurtLocker is offline   Reply With Quote
Old 22/05/2013, 08:35 PM   #4
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,096
Reputation: 2655
Default Re: how to compare string cell to character?

OnPlayerCommandText gets called for every input that starts with a forward slash. What is so hard to understand about that?
__________________
Vince is offline   Reply With Quote
Old 22/05/2013, 08:41 PM   #5
HurtLocker
Gangsta
 
HurtLocker's Avatar
 
Join Date: Dec 2012
Location: Hellas, Thessaloniki
Posts: 569
Reputation: 29
Default AW: how to compare string cell to character?

Ok I did this:
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (Jailed[playerid]==true) return SendClientMessage(playerid, 0xFF0000AA, "blabla");
return 0;
}
doesn't work
__________________
Join Fallout's Best TDM server ever!
Useful command: Sounds finder
Turotial: Making a textdraw without editors
HurtLocker is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
String and number compare. budelis Scripting Help 5 30/08/2012 10:53 AM
Compare two string Kyra Scripting Help 9 21/07/2012 02:30 AM
compare empty String reini90 Server Support 3 14/03/2012 01:15 PM
compare string ombre Scripting Help 8 19/11/2011 11:56 AM
<<>> Compare STRING Ricop522 Help Archive 0 24/06/2011 12:09 AM


All times are GMT. The time now is 04:36 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.