SA-MP Forums Archive
Tag mismatch - 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: Tag mismatch (/showthread.php?tid=641252)



Tag mismatch - Cubie - 13.09.2017

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



Re: Tag mismatch - NaS - 13.09.2017

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]))



Re: Tag mismatch - n00blek - 13.09.2017

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


Re: Tag mismatch - Cubie - 13.09.2017

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.


Re: Tag mismatch - billy1337samp - 24.11.2017

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

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


Re: Tag mismatch - thefirestate - 24.11.2017

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


Re: Tag mismatch - billy1337samp - 24.11.2017

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


Re: Tag mismatch - thefirestate - 24.11.2017

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