SA-MP Forums Archive
warning 215: expression has no effect - 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: warning 215: expression has no effect (/showthread.php?tid=659741)



warning 215: expression has no effect - ZigGamerx - 14.10.2018

Warnings
Код:
 
G:\Pawno\MW3SAMP-master\gamemodes\minigames.pwn(73) : warning 215: expression has no effect
G:\Pawno\MW3SAMP-master\gamemodes\minigames.pwn(79) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2016, ITB CompuPhase


2 Warnings.
Codes
Код:
CMD:vgod(playerid)
{
   if(PlayerInfo[playerid][pVIP] >= 2) return SendClientMessage(playerid, COLOR_RED, "You don't have V.I.P Access to you're account.");
   {
	 if(PlayerInfo[playerid][pGOD] < 0)
	 {
		SetPlayerHealth(playerid, 999999999);
        SendClientMessage(playerid, COLOR_GREEN, "You have enabled God Mode.");
        PlayerInfo[playerid][pGOD] < 1;
     }
     if(PlayerInfo[playerid][pGOD] < 1)
	 {
		SetPlayerHealth(playerid, 100);
        SendClientMessage(playerid, COLOR_GREEN, "You have disabled God Mode.");
        PlayerInfo[playerid][pGOD] == 0;
     }
   }
   return 1;
}
CODE IMAGE FOR LINES
https://imgur.com/a/YGuXMt9


Re: warning 215: expression has no effect - Chyakka - 14.10.2018

Код:
PlayerInfo[playerid][pGOD] == 0;
PlayerInfo[playerid][pGOD] < 1;
You're trying to use selection operators to set variables.

It should be:
Код:
CMD:vgod(playerid)
{
   if(PlayerInfo[playerid][pVIP] >= 2) return SendClientMessage(playerid, COLOR_RED, "You don't have V.I.P Access to you're account.");
   {
	 if(PlayerInfo[playerid][pGOD] < 0)
	 {
		SetPlayerHealth(playerid, 999999999);
        SendClientMessage(playerid, COLOR_GREEN, "You have enabled God Mode.");
        PlayerInfo[playerid][pGOD] = 1;
     }
     if(PlayerInfo[playerid][pGOD] < 1)
	 {
		SetPlayerHealth(playerid, 100);
        SendClientMessage(playerid, COLOR_GREEN, "You have disabled God Mode.");
        PlayerInfo[playerid][pGOD] = 0;
     }
   }
   return 1;
}



Re: warning 215: expression has no effect - KinderClans - 14.10.2018

pawn Код:
CMD:vgod(playerid)
{
   if(PlayerInfo[playerid][pVIP] != 2) return SendClientMessage(playerid, COLOR_RED, "You don't have V.I.P Access to your account.");

   switch (PlayerInfo[playerid][pGOD])
   {
        case 0:
        {
            SetPlayerHealth(playerid, 999999999);
            SendClientMessage(playerid, COLOR_GREEN, "You have enabled God Mode.");
            PlayerInfo[playerid][pGOD] = 1;
        }
       
        case 1:
        {
            SetPlayerHealth(playerid, 100);
            SendClientMessage(playerid, COLOR_GREEN, "You have disabled God Mode.");
            PlayerInfo[playerid][pGOD] = 0;
        }
   }
   return 1;
}



Re: warning 215: expression has no effect - Beckett - 14.10.2018

Код:
PlayerInfo[playerid][pGOD] == 0;
The double = has no effect here.

Код:
PlayerInfo[playerid][pGOD] = 0;



Re: warning 215: expression has no effect - UFF - 15.10.2018

pawn Код:
CMD:vgod(playerid)
{
   if(PlayerInfo[playerid][pVIP] < 2)
              return SendClientMessage(playerid, COLOR_RED, "You don't have V.I.P Access to you're account.");
     if(PlayerInfo[playerid][pGOD] == 0)
     {
        SetPlayerHealth(playerid, 999999999);
        SendClientMessage(playerid, COLOR_GREEN, "You have enabled God Mode.");
        PlayerInfo[playerid][pGOD] = 1;
     }
     else if(PlayerInfo[playerid][pGOD] == 1)
     {
        SetPlayerHealth(playerid, 100);
        SendClientMessage(playerid, COLOR_GREEN, "You have disabled God Mode.");
        PlayerInfo[playerid][pGOD] = 0;
     }
     return 1;
}



Re: warning 215: expression has no effect - v1k1nG - 15.10.2018

It's better to explain how to solve a problem rather than just giving (very simple) 2 code lines to act pro and get Rep.
If you know how to fix it, explain it too.


Re: warning 215: expression has no effect - UFF - 15.10.2018

Quote:
Originally Posted by v1k1nG
Посмотреть сообщение
It's better to explain how to solve a problem rather than just giving (very simple) 2 code lines to act pro and get Rep.
If you know how to fix it, explain it too.
Lol I'm not here to get rep since i know him for a long time. Anyhow he can simply use else condition to check whether Godmode is on or off.
Example:
Код:
if(god[pID] == 0)
{
   printf("God is OFF");
}
else if(god[pID] == 1)
{
  printf("God is ON");
}