Help me
#1

I was Doing a anti cheat in my gamemode

Код:
if(GetPlayerWeapon(playerid) == 16 || GetPlayerWeapon(playerid) == 17 || GetPlayerWeapon(playerid) == 18 || GetPlayerWeapon(playerid) == 35 || GetPlayerWeapon(playerid) == 36 || GetPlayerWeapon(playerid) == 37 || GetPlayerWeapon(playerid) == 38 || GetPlayerWeapon(playerid) == 39 || GetPlayerWeapon(playerid) == 40 || GetPlayerWeapon(playerid) == 42) && PlayerInfo[playerid][pAdminlevel] < 1)
And i get this error
Код:
C:\Documents and Settings\john phol\Desktop\gamemodes\DEATHMATCH.pwn(29341) : error 029: invalid expression, assumed zero
C:\Documents and Settings\john phol\Desktopgamemodes\DEATHMATCH.pwn(29341) : warning 215: expression has no effect
C:\Documents and Settings\john phol\Desktop\gamemodes\DEATHMATCH.pwn(29341) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\john phol\Desktop\gamemodes\DEATHMATCH.pwn(29341) : error 029: invalid expression, assumed zero
C:\Documents and Settings\john phol\Desktop\gamemodes\DEATHMATCH.pwn(29341) : fatal error 107: too many error messages on one line
Reply
#2

Код:
if(GetPlayerWeapon(playerid) == 16 || GetPlayerWeapon(playerid) == 17 || GetPlayerWeapon(playerid) == 18 || GetPlayerWeapon(playerid) == 35 || GetPlayerWeapon(playerid) == 36 || GetPlayerWeapon(playerid) == 37 || GetPlayerWeapon(playerid) == 38 || GetPlayerWeapon(playerid) == 39 || GetPlayerWeapon(playerid) == 40 || GetPlayerWeapon(playerid) == 42) && PlayerInfo[playerid][pAdminlevel] < 1)
remove red highlighted bracket
Reply
#3

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
Код:
if(GetPlayerWeapon(playerid) == 16 || GetPlayerWeapon(playerid) == 17 || GetPlayerWeapon(playerid) == 18 || GetPlayerWeapon(playerid) == 35 || GetPlayerWeapon(playerid) == 36 || GetPlayerWeapon(playerid) == 37 || GetPlayerWeapon(playerid) == 38 || GetPlayerWeapon(playerid) == 39 || GetPlayerWeapon(playerid) == 40 || GetPlayerWeapon(playerid) == 42) && PlayerInfo[playerid][pAdminlevel] < 1)
remove red highlighted bracket
I dont that's what he want, he want to check if player have one of the choosen weapons and not admin, as the admins can giveweapon without cheat, if yes here is the code

PHP код:
if((GetPlayerWeapon(playerid) == 16 || GetPlayerWeapon(playerid) == 17 || GetPlayerWeapon(playerid) == 18 || GetPlayerWeapon(playerid) == 35 || GetPlayerWeapon(playerid) == 36 || GetPlayerWeapon(playerid) == 37 || GetPlayerWeapon(playerid) == 38 || GetPlayerWeapon(playerid) == 39 || GetPlayerWeapon(playerid) == 40 || GetPlayerWeapon(playerid) == 42) && pAdmin[playerid] < 1
Reply
#4

Quote:
Originally Posted by Shinja
Посмотреть сообщение
I dont that's what he want, he want to check if player have one of the choosen weapons and not admin, as the admins can giveweapon without cheat, if yes here is the code

PHP код:
if((GetPlayerWeapon(playerid) == 16 || GetPlayerWeapon(playerid) == 17 || GetPlayerWeapon(playerid) == 18 || GetPlayerWeapon(playerid) == 35 || GetPlayerWeapon(playerid) == 36 || GetPlayerWeapon(playerid) == 37 || GetPlayerWeapon(playerid) == 38 || GetPlayerWeapon(playerid) == 39 || GetPlayerWeapon(playerid) == 40 || GetPlayerWeapon(playerid) == 42) && pAdmin[playerid] < 1
please stop helping you are just posting something you dont know....
both of them are same.
Reply
#5

Quote:
Originally Posted by GhostHacker
Посмотреть сообщение
please stop helping you are just posting something you dont know....
both of them are same.
You sure? they are NOT same dude
Reply
#6

Quote:
Originally Posted by Shinja
Посмотреть сообщение
You sure? they are NOT same dude
i wont blah blah on things that im unaware i will stay away from such threads but if im 100% sure about a thing then i will post and YES BOTH ARE SAME.
Reply
#7

Shinja, they both are the same but the better method of doing is the one you mentioned.

Quote:

This forum requires that you wait 120 seconds between posts. Please try again in 34 seconds.

Thanks anti-spam.
Reply
#8

Quote:
Originally Posted by ALiScripter
Посмотреть сообщение
Shinja, they both are the same but the better method of doing is the one you mentioned.
care to explain why that one is better? when both of them are same ?
Reply
#9

Quote:
Originally Posted by GhostHacker
Посмотреть сообщение
care to explain why that one is better? when both of them are same ?
Both are same but as we consider the readability of the code the one shinja told will be better
Reply
#10

Quote:
Originally Posted by GhostHacker
Посмотреть сообщение
care to explain why that one is better? when both of them are same ?
PHP код:
if(== || == || == && PlayerInfo[playerid][pAdminlevel] < 1
Can be executed also as
PHP код:
if(== || == || (== && PlayerInfo[playerid][pAdminlevel] < 1)) 
But if we do
PHP код:
if((== || == || == 1) && PlayerInfo[playerid][pAdminlevel] < 1
Its 100% clean
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)