Tag mismatch
#1

I could use a hand,
Thanks in advance.

PHP код:
                case 5:
                {
                    new 
id GetPVarInt(playerid"DialogValue1");
                    if(
GetPlayerVehicleAccess(playeridid) < 2)
                    {
                        
ShowErrorDialog(playerid"You are not the owner of this vehicle.");
                        return 
1;
                    }
                    if(!
strcmp(VehicleNumberPlate[id], PlayerInfo[playerid][pPlate1]) == 0)
                    {
                        
PlayerInfo[playerid][pPlate1] = 0;
                        new 
INI:File INI_Open(UserPath(playerid));
                        
INI_SetTag(File,"data");
                        
INI_WriteInt(File"Plate1"PlayerInfo[playerid][pPlate1]);
                        
INI_Close(File);
                    }
                    else if(!
strcmp(VehicleNumberPlate[id], PlayerInfo[playerid][pPlate2]) == 0)
                    {
                        
PlayerInfo[playerid][pPlate2] = 0;
                        new 
INI:File INI_Open(UserPath(playerid));
                        
INI_SetTag(File,"data");
                        
INI_WriteInt(File"Plate2"PlayerInfo[playerid][pPlate2]);
                        
INI_Close(File);
                    }
                    else if(!
strcmp(VehicleNumberPlate[id], PlayerInfo[playerid][pPlate3]) == 0)
                     {
                        
PlayerInfo[playerid][pPlate3] = 0;
                        new 
INI:File INI_Open(UserPath(playerid));
                        
INI_SetTag(File,"data");
                        
INI_WriteInt(File"Plate3"PlayerInfo[playerid][pPlate3]);
                        
INI_Close(File);
                    }
                    new 
msg[128];
                    
VehicleCreated[id] = 0;
                    new 
money VehicleValue[id]/2;
                    
GivePlayerMoney(playeridmoney);
                    
format(msgsizeof(msg), "You have sold your vehicle for $%d."money);
                    
SendClientMessage(playeridCOLOR_WHITEmsg);
                    
RemovePlayerFromVehicle(playerid);
                    
DestroyVehicle(VehicleID[id]);
                    
SaveVehicle(id);
                } 
tag mismatches:
PHP код:
if(!strcmp(VehicleNumberPlate[id], PlayerInfo[playerid][pPlate1]) == 0
else if(!
strcmp(VehicleNumberPlate[id], PlayerInfo[playerid][pPlate2]) == 0
else if(!
strcmp(VehicleNumberPlate[id], PlayerInfo[playerid][pPlate3]) == 0
Reply
#2

Don't use ! and == 0 at once.

It's the same expression. Both check for the value being zero.

Just do

Код:
if(strcmp(VehicleNumberPlate[id], PlayerInfo[playerid][pPlate1]) == 0)
or

Код:
if(!strcmp(VehicleNumberPlate[id], PlayerInfo[playerid][pPlate1]))
Reply
#3

you cant use !strcmp and == 0 on end. chose one; like NaS said
Reply
#4

Quote:
Originally Posted by NaS
Посмотреть сообщение
Don't use ! and == 0 at once.

It's the same expression. Both check for the value being zero.

Just do

Код:
if(strcmp(VehicleNumberPlate[id], PlayerInfo[playerid][pPlate1]) == 0)
or

Код:
if(!strcmp(VehicleNumberPlate[id], PlayerInfo[playerid][pPlate1]))
Quote:
Originally Posted by n00blek
Посмотреть сообщение
you cant use !strcmp and == 0 on end. chose one; like NaS said
Thanks guys. Appreciated.
Reply
#5

! = false
so there's no point doing ! and == 0

same as doing (IsPlayerAdmin == 1) wrong <
you should do (IsPlayerAdmin)
Reply
#6

You could've not bump an over 2 month old topic that is already solved? :/
Reply
#7

this answer can be for all the people no just topic starter
Reply
#8

Hell yes, that would be useful! Except for the part that about 3-4 other comments say that exact same thing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)