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: Problem "!=". (
/showthread.php?tid=596592)
Problem "!=". -
norton2 - 20.12.2015
My
pLeader = 8, and show message "
Not Hitman!". Why?
Код HTML:
if(pInfo[playerid][pMember] != 8 || pInfo[playerid][pLeader] != 8) return SendClientMessage(playerid, COLOR_DARKGRAY, "Not Hitman!");
Re: Problem "!=". -
]Rafaellos[ - 20.12.2015
pInfo[playerid][pMember] must be 8 too.
Re: Problem "!=". -
norton2 - 20.12.2015
But use "
||" not "
&&".
Re: Problem "!=". -
]Rafaellos[ - 20.12.2015
|| Means OR. So either the one, either the other.
Re: Problem "!=". -
Vince - 20.12.2015
I never understood the reasoning behind the logic of pMember <-> pLeader. Clearly, "leader" is a property of faction, not a property of player, and if a player is the leader then he implicitly or explicitly ought to be a member as well. Let's say you have 10 factions and 20,000 registered players. Now 10 players will have an actual value saved in their account and 19,990 players will have 0 saved in their account. I hope you realize how silly that is.
Re: Problem "!=". -
norton2 - 20.12.2015
Quote:
Originally Posted by Vince
I never understood the reasoning behind the logic of pMember <-> pLeader. Clearly, "leader" is a property of faction, not a property of player, and if a player is the leader then he implicitly or explicitly ought to be a member as well. Let's say you have 10 factions and 20,000 registered players. Now 10 players will have an actual value saved in their account and 19,990 players will have 0 saved in their account. I hope you realize how silly that is.
|
And what would be better to do?
Re: Problem "!=". -
thefirestate - 20.12.2015
Quote:
Originally Posted by norton2
And what would be better to do?
|
A lot of ways , for, I personally check if the player rank is 10 (Highest faction rank) and if it is, then he can do all faction leader commands. Another way would be(If you are using SQLite or MySQL) to save somewhere the unique player SQL ID and then check if the player's unique SQL ID is equal to the faction he is member in's leader SQL ID and the third way I can think of is to save the leader's name again in faction information and use strcmp to compare if the saved leader's name matches the player who executed the command.