Help with "||"
#6

Quote:
Originally Posted by ImTobi
View Post
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, "Du bist kein Mitglied vom SFPD oder 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?
Guessing that ID 1 and 4 represent SFPD and LSPD, that should work
If you are ID 1, the first check will return false which will skip the other check, which in turn just skips over the if statement and its code block. Same idea for ID 4.
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)