comparing strings
#1

Im trying to compare if 2 things are the same, but it doesnt work. I used:
pawn Код:
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.
Reply
#2

pawn Код:
if(!strcmp(PlayerInfo[playerid][pCarKey2], PlayerInfo[playerid][pCarSel]))
https://sampwiki.blast.hk/wiki/Strcmp
Reply
#3

I used, but still doesnt work.
pawn Код:
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)