SA-MP Forums Archive
17485) : warning 213: 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: 17485) : warning 213: tag mismatch (/showthread.php?tid=569239)



17485) : warning 213: tag mismatch - AdiRoS - 29.03.2015

this is the code(the line): http://pastebin.com/7Db1zrhz

and i have more Warning:
Код HTML:
(2260) : warning 235: public function lacks forward declaration (symbol "OnPlayerShootPlayer")
the code:
Код HTML:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{



Re: 17485) : warning 213: tag mismatch - CalvinC - 29.03.2015

pawn Код:
!strcmp(cmd, "/engine", true) == 0
! checks if it returns 0, but you're also doing == 0 to check if it returns 0.
Either just have !strcmp or == 0, not both.

And the second "|| strcmp" check's if it does not return 0, since you don't have ! or == 0.
Therefore your command will trigger if you use /engine or anything other than /e.
So you need to put ! or == 0 with the second as well.

(Note: Strcmp returns 0 if you entered the string, /engine or /e, but it return 1 or -1 if you did not.)

OnPlayerShootPlayer requires the OPSP (OnPlayerShootPlayer) include.


Re: 17485) : warning 213: tag mismatch - iZN - 29.03.2015

OnPlayerShootPlayer() callback requires a forward declaration.

PHP код:
forward OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost); // place this anywhere you want, but it should be before the callback 



Re: 17485) : warning 213: tag mismatch - CalvinC - 29.03.2015

Quote:
Originally Posted by iZN
Посмотреть сообщение
OnPlayerShootPlayer() callback requires a forward declaration.

PHP код:
forward OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost); // place this anywhere you want, but it should be before the callback 
Yes, but he's trying to use the OnPlayerShootPlayer include.
https://sampforum.blast.hk/showthread.php?pid=937824#pid937824


Re: 17485) : warning 213: tag mismatch - iZN - 29.03.2015

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
Yes, but he's trying to use the OnPlayerShootPlayer include.
https://sampforum.blast.hk/showthread.php?pid=937824#pid937824
yes I know, and I forgot to mention, why the OP even needs this include? when there's this:

pawn Код:
OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)



Re: 17485) : warning 213: tag mismatch - AdiRoS - 29.03.2015

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
pawn Код:
!strcmp(cmd, "/engine", true) == 0
! checks if it returns 0, but you're also doing == 0 to check if it returns 0.
Either just have !strcmp or == 0, not both.

And the second "|| strcmp" check's if it does not return 0, since you don't have ! or == 0.
Therefore your command will trigger if you use /engine or anything other than /e.
So you need to put ! or == 0 with the second as well.

(Note: Strcmp returns 0 if you entered the string, /engine or /e, but it return 1 or -1 if you did not.)

OnPlayerShootPlayer requires the OPSP (OnPlayerShootPlayer) include.
You can send me the repair code for "/engine" in pastebin ?
and i have more bug in /tazer
the command give me gun but the gun isn't give tazer.

the code:
Код HTML:
if(strcmp(cmd, "/tazer", true) ==0 || strcmp(cmd, "/ta", true) ==0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(IsACop(playerid))
			{
			        new Ammo = GetPlayerAmmo(playerid);
					if(Ammo < 0)
					    return 1;
					if(GetPlayerWeapon(playerid)==24)
					{
                        AC_RemovePlayerWeapon(playerid, 24);
                        AC_GivePlayerWeapon(playerid,23,Ammo);
                        format(string, sizeof(string), "* %s unholsters his/her tazer.", sendername);
						ProxDetector(30.0, playerid, string, COLOR_SKYBLUE,COLOR_SKYBLUE,COLOR_SKYBLUE,COLOR_SKYBLUE,COLOR_SKYBLUE);
					}
					else if(GetPlayerWeapon(playerid)==23)
					{
					    AC_RemovePlayerWeapon(playerid, 23);
					    AC_GivePlayerWeapon(playerid,24,Ammo);
					    format(string, sizeof(string), "* %s holsters his/her tazer.", sendername);
						ProxDetector(30.0, playerid, string, COLOR_SKYBLUE,COLOR_SKYBLUE,COLOR_SKYBLUE,COLOR_SKYBLUE,COLOR_SKYBLUE);
					}
			}
			else return SendClientMessage(playerid, COLOR_GREY, "You are not a Cop!");
		}
		return 1;
	}



Re: 17485) : warning 213: tag mismatch - CalvinC - 29.03.2015

pawn Код:
if(!strcmp(cmd, "/engine", true) ==0 || strcmp(cmd, "/e", true))
Just use either ! or == 0, not both, since they do the same thing.
And you need to do the same in the second strcmp as well.
pawn Код:
if(!strcmp(cmd, "/engine", true) || !strcmp(cmd, "/e", true))
EDIT:
Quote:
Originally Posted by iZN
yes I know, and I forgot to mention, why the OP even needs this include? when there's this:

Код:
OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
There's OnPlayerTakeDamage and OnPlayerGiveDamage as well which would be just as good, but it's his decision what he wants.


Re: 17485) : warning 213: tag mismatch - AdiRoS - 30.03.2015

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
pawn Код:
if(!strcmp(cmd, "/engine", true) ==0 || strcmp(cmd, "/e", true))
Just use either ! or == 0, not both, since they do the same thing.
And you need to do the same in the second strcmp as well.
pawn Код:
if(!strcmp(cmd, "/engine", true) || !strcmp(cmd, "/e", true))
The Command its ok ty