Help with "||"
#5

Quote:
Originally Posted by Jstylezzz
View Post
Technically this if statement will trigger when your faction is not 1 and when it's not 4. The thing is, when faction is equal to 1, it is not equal to 4, which causes the if statement to trigger. Same the other way around. If your faction is 4, it is not 1, which will cause the first check to trigger the if statement.

I'm guessing this is part of a command? Which faction IDs should be able to use it? If both ID 1 and ID 4 are allowed to use it, you can change || to &&.
Code:
CMD:pdht(playerid, params[])
{
	if(eingeloggt[playerid] == 0)return SendClientMessage(playerid, COLOR_RED, "Du bist noch nicht eingeloggt.");
	if(pInfo[playerid][fraktion] != 1 && pInfo[playerid][fraktion] != 4)return SendClientMessage(playerid, COLOR_RED, "You aren't a member of the SFPD or the LSPD.");
	if(pInfo[playerid][duty] != 1)return SendClientMessage(playerid, COLOR_RED, "Du bist nicht im Dienst.");
	if(SWAT[playerid] == 1)return SendClientMessage(playerid, COLOR_RED, "Du kannst keine Weste anziehen wenn du SWAT bist.");
	if(GetPVarInt(playerid,"HutAn") == 1)
	{
		SetPVarInt(playerid, "HutAn", 0);
		//DestroyObject(PDHut[playerid]);
		RemovePlayerAttachedObject(playerid, 1);
		SendClientMessage(playerid, COLOR_WHITE, "Du hast den Hut abgenommen.");
		pdhutan[playerid] = 0;
		return 1;
	}
	SetPVarInt(playerid,"HutAn",1);
	//new Float:x,Float:y,Float:z;
	//GetPlayerPos(playerid,x,y,z);
	//PDHut[playerid] = CreateObject(19096, x,y,z, 0.0000, -90.0000, 0.0000); //CowboyHat3
	SetPlayerAttachedObject(playerid, 1, 19096, 2, 0.130, 0.012, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0,0);
	SendClientMessage(playerid, COLOR_WHITE, "Du hast den Hut aufgesetzt.");
	pdhutan[playerid] = 1;
	return 1;
}
so like that?
Reply


Messages In This Thread
Help with "||" - by ImTobi - 14.04.2019, 17:36
Re: Help with "||" - by Jstylezzz - 14.04.2019, 19:13
Re: Help with "||" - by ImTobi - 14.04.2019, 19:21
Re: Help with "||" - by Jstylezzz - 14.04.2019, 19:28
Re: Help with "||" - by ImTobi - 14.04.2019, 19:29
Re: Help with "||" - by Jstylezzz - 14.04.2019, 19:31
Re: Help with "||" - by ImTobi - 14.04.2019, 19:36

Forum Jump:


Users browsing this thread: 1 Guest(s)