comparing strings - 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)
+--- Thread: comparing strings (
/showthread.php?tid=308132)
comparing strings -
HondaCBR - 02.01.2012
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.
AW: comparing strings -
BigETI - 02.01.2012
pawn Код:
if(!strcmp(PlayerInfo[playerid][pCarKey2], PlayerInfo[playerid][pCarSel]))
https://sampwiki.blast.hk/wiki/Strcmp
Re: comparing strings -
HondaCBR - 02.01.2012
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.