PDA

View Full Version : 17485) : warning 213: tag mismatch


AdiRoS
29/03/2015, 07:20 AM
this is the code(the line): http://pastebin.com/7Db1zrhz

and i have more Warning: (2260) : warning 235: public function lacks forward declaration (symbol "OnPlayerShootPlayer")

the code: public OnPlayerShootPlayer(Shooter,Target,Float:HealthLos t,Float:ArmourLost)
{

CalvinC
29/03/2015, 08:20 AM
!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.

iZN
29/03/2015, 08:23 AM
OnPlayerShootPlayer() callback requires a forward declaration.

forward OnPlayerShootPlayer(Shooter,Target,Float:HealthLos t,Float:ArmourLost); // place this anywhere you want, but it should be before the callback

CalvinC
29/03/2015, 08:48 AM
OnPlayerShootPlayer() callback requires a forward declaration.

forward OnPlayerShootPlayer(Shooter,Target,Float:HealthLos t,Float:ArmourLost); // place this anywhere you want, but it should be before the callback

Yes, but he's trying to use the OnPlayerShootPlayer include.
http://forum.sa-mp.com/showthread.php?p=937824

iZN
29/03/2015, 09:37 AM
Yes, but he's trying to use the OnPlayerShootPlayer include.
http://forum.sa-mp.com/showthread.php?p=937824

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)

AdiRoS
29/03/2015, 09:53 AM
!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:
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_SK YBLUE,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_SK YBLUE,COLOR_SKYBLUE);
}
}
else return SendClientMessage(playerid, COLOR_GREY, "You are not a Cop!");
}
return 1;
}

CalvinC
29/03/2015, 10:43 AM
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.
if(!strcmp(cmd, "/engine", true) || !strcmp(cmd, "/e", true))

EDIT:
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.

AdiRoS
30/03/2015, 09:32 AM
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.
if(!strcmp(cmd, "/engine", true) || !strcmp(cmd, "/e", true))

The Command its ok ty :)