Deep bug in zcmd?
#1

I have a nice problem with zcmd and `if`

For most of commands i use check
pawn Код:
if(PlayerInfo[playerid][pMember] != 1 || PlayerInfo[playerid][pLeader] != 1) return SendClientMessage(playerid, COLOR_GRAD1, "* You are not a cop.");
So there is big problem. I set for my character `pMember` to 1. Ofcourse `pLeader` i leave alone and it is 0.

When doing command it wont pass check if i have `pMember` - `1`

pawn Код:
if(PlayerInfo[playerid][pMember] != 1 || PlayerInfo[playerid][pLeader] != 1) return SendClientMessage(playerid, COLOR_GRAD1, "* You are not a cop.");
//the code wont be used if `pMember` is 1 and `pLeader` is 0
if `pLeader` is 1 and `pMembe`r is 0 it works. Also it works if bouth of them are setted to 1.

So whats the problem?

pMember check works in other script parts like onpolayerspawn callback etc.
Reply
#2

The if-statements there will return false only when both pLeader and pMember is set to 0.

This should work:
pawn Код:
if(!PlayerInfo[playerid][pMember] && !PlayerInfo[playerid][pLeader]) return SendClientMessage(playerid, COLOR_GRAD1, "* You are not a cop.");
Reply
#3

Quote:
Originally Posted by g_aSlice
Посмотреть сообщение
pawn Код:
if(!PlayerInfo[playerid][pMember] && !PlayerInfo[playerid][pLeader]) return SendClientMessage(playerid, COLOR_GRAD1, "* You are not a cop.");
Thanks for reply but I need to check if it is `1` because I am using more than `1` if you understood what i mean.

pMember - 1 should be cops
pMember - 3 should be something else - like a team.

So i think your version wont suit there.
Reply
#4

G..... It was too smart for me. trololololō

So ****** your version is like, `if not, member 1 and leader 0 then send message` so in this cas i would need to add more and more checks for player like `if member 0 and !leader > 1` is there any simplier way so i dont need to waste "memory" ghouash.. memory lol..

it would wrok if i do like this?
pawn Код:
if(Member == 1 || Leader == 1) {}
else return message.
Everybody knows that i`m too lazy.


-------------------

Omg the pawno becomes harder and harder for me ;S It was so easy with 0.2
Reply
#5

never mind works :P

Ahm.. if you know goadfather then you know what i am talking about - about something similar
pMember and pLeader are valued variables in enum used with PlayerInfo[MAX_PLAYERS][enumname]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)