SA-MP Forums Archive
I have problem - 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: I have problem (/showthread.php?tid=583201)



I have problem - tomaytb - 26.07.2015

Hi I have a problem! gives me this error:
D:\Desktop\E-Gaming\gamemodes\egaming.pwn(8570) : warning 211: possibly unintended assignment
D:\Desktop\E-Gaming\gamemodes\egaming.pwn(8570) : error 022: must be lvalue (non-constant)
D:\Desktop\E-Gaming\gamemodes\egaming.pwn(8570) : warning 215: expression has no effect
D:\Desktop\E-Gaming\gamemodes\egaming.pwn(8570) : error 001: expected token: ";", but found ")"
D:\Desktop\E-Gaming\gamemodes\egaming.pwn(8570) : error 029: invalid expression, assumed zero
D:\Desktop\E-Gaming\gamemodes\egaming.pwn(8570) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.



This is the line .. How can I fix
if(newcar == 106 || newcar == 107 || newcar == 108 || newcar == 109 || newcar == 144 || newcar == 145 || newcar == 146 || newcar = 14
{
if(PlayerInfo[playerid][pMember] != 13 && PlayerInfo[playerid][pLeader] != 13)
{
SendClientMessage(playerid,COLOR_WHITE,"Nu esti membru {E4895E}Orleans Crime Family{FFFFFF}!");
RemovePlayerFromVehicle(playerid);
}
if(newcar == 105 && PlayerInfo[playerid][pRank] < 4)
{
SendClientMessage(playerid,COLOR_WHITE,"Iti trebuie {E4895E}rank 4{FFFFFF}!");
RemovePlayerFromVehicle(playerid);
}
}


Re: I have problem - TwinkiDaBoss - 26.07.2015

pawn Код:
if(newcar == 106 || newcar == 107 || newcar == 108 || newcar == 109 || newcar == 144 || newcar == 145 || newcar == 146 || newcar = 14)
{
    if(PlayerInfo[playerid][pMember] != 13 && PlayerInfo[playerid][pLeader] != 13)
    {
        SendClientMessage(playerid,COLOR_WHITE,"Nu esti membru {E4895E}Orleans Crime Family{FFFFFF}!");
        RemovePlayerFromVehicle(playerid);
    }
    if(newcar == 105 && PlayerInfo[playerid][pRank] < 4)
    {
        SendClientMessage(playerid,COLOR_WHITE,"Iti trebuie {E4895E}rank 4{FFFFFF}!");
        RemovePlayerFromVehicle(playerid);
    }
}
Works like this?


EDIT: If it doesnt, link what is the error link in the next post, only that line!


Re: I have problem - Yashas - 27.07.2015

You actually tried to assign a value to newcar in your last condition in your if statement which must have caused the unintended assignment warning. Just for your information, it is possible to assign values within the if statement which when put into proper use can make your code a little faster.

Код:
if((newcar = !newcar)) //Toggle newcar
{
   //will be executed if newcar was false
}
In your case, using a switch might make the code significantly faster.

Код:
switch(newcar)
{
	case 106,107,108,109,144,145,146,148:
	{
	    if(PlayerInfo[playerid][pMember] != 13 && PlayerInfo[playerid][pLeader] != 13)
		{
			SendClientMessage(playerid,COLOR_WHITE,"Nu esti membru {E4895E}Orleans Crime Family{FFFFFF}!");
			RemovePlayerFromVehicle(playerid);
		}
		if(newcar == 105 && PlayerInfo[playerid][pRank] < 4)
		{
			SendClientMessage(playerid,COLOR_WHITE,"Iti trebuie {E4895E}rank 4{FFFFFF}!");
			RemovePlayerFromVehicle(playerid);
		}
	}
}



Re: I have problem - tomaytb - 27.07.2015

Quote:
Originally Posted by Yashas
Посмотреть сообщение
You actually tried to assign a value to newcar in your last condition in your if statement which must have caused the unintended assignment warning. Just for your information, it is possible to assign values within the if statement which when put into proper use can make your code a little faster.

Код:
if((newcar = !newcar)) //Toggle newcar
{
   //will be executed if newcar was false
}
In your case, using a switch might make the code significantly faster.

Код:
switch(newcar)
{
	case 106,107,108,109,144,145,146,148:
	{
	    if(PlayerInfo[playerid][pMember] != 13 && PlayerInfo[playerid][pLeader] != 13)
		{
			SendClientMessage(playerid,COLOR_WHITE,"Nu esti membru {E4895E}Orleans Crime Family{FFFFFF}!");
			RemovePlayerFromVehicle(playerid);
		}
		if(newcar == 105 && PlayerInfo[playerid][pRank] < 4)
		{
			SendClientMessage(playerid,COLOR_WHITE,"Iti trebuie {E4895E}rank 4{FFFFFF}!");
			RemovePlayerFromVehicle(playerid);
		}
	}
}



I LOVE YOU THX MAN !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1