SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 02/01/2012, 01:47 PM   #1
HondaCBR
Huge Clucker
 
Join Date: Apr 2011
Posts: 286
Reputation: 0
Default comparing strings

Im trying to compare if 2 things are the same, but it doesnt work. I used:
pawn Code:
if(strcmp(PlayerInfo[playerid][pCarKey2],PlayerInfo[playerid][pCarSel]))
And it doesnt matter if they = each other or not, it will go thorugh like they do.
HondaCBR is offline   Reply With Quote
Old 02/01/2012, 01:58 PM   #2
BigETI
Banned
 
Join Date: Mar 2010
Location: Germany
Posts: 1,046
Reputation: 359
Default AW: comparing strings

pawn Code:
if(!strcmp(PlayerInfo[playerid][pCarKey2], PlayerInfo[playerid][pCarSel]))
http://wiki.sa-mp.com/wiki/Strcmp
BigETI is offline   Reply With Quote
Old 02/01/2012, 02:15 PM   #3
HondaCBR
Huge Clucker
 
Join Date: Apr 2011
Posts: 286
Reputation: 0
Default Re: comparing strings

I used, but still doesnt work.
pawn Code:
if(!strcmp(PlayerInfo[playerid][pCarKey1], PlayerInfo[playerid][pCarSel]))
        {
            format(globalcar1,sizeof(globalcar1),"{00FF00}%s\t\t (UID: %d)",aVehicleNames[ model1 - 400 ],PlayerInfo[playerid][pCarKey1]);
        }
        else
        {
            format(globalcar1,sizeof(globalcar1),"%s\t\t (UID: %d)",aVehicleNames[ model1 - 400 ],PlayerInfo[playerid][pCarKey1]);
        }
        if(!strcmp(PlayerInfo[playerid][pCarKey2], PlayerInfo[playerid][pCarSel]))
        {
            format(globalcar2,sizeof(globalcar2),"{00FF00}%s\t\t (UID: %d)",aVehicleNames[ model2 - 400 ],PlayerInfo[playerid][pCarKey2]);
        }
        else
        {
            format(globalcar2,sizeof(globalcar2),"%s\t\t (UID: %d)",aVehicleNames[ model2 - 400 ],PlayerInfo[playerid][pCarKey2]);
        }

Basically when you choose car1 it sets pCarSel to pCarKey1
if you choose car2 it sets pCarSel to pCarKey2

And what I want is, the selected car to be green in the dialgo. But they are all the time, colour doesnt change.
HondaCBR 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
Comparing strings error HondaCBR Scripting Help 6 21/11/2011 04:19 PM
Help with comparing two strings OUL Scripting Help 2 02/11/2011 05:11 PM
Comparing. Exsite Help Archive 2 25/05/2011 03:23 PM
[Help] Comparing strings (strcmp) Maxips2 Help Archive 2 03/08/2010 09:46 AM
comparing ips ?? BLAbla93 Help Archive 0 23/05/2010 03:55 AM


All times are GMT. The time now is 01:38 PM.


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