SA-MP Forums Archive
Help me - 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: Help me (/showthread.php?tid=614237)



Help me - CrazyPerry - 06.08.2016

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



Re: Help me - SyS - 06.08.2016

Код:
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


Re: Help me - Shinja - 06.08.2016

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



Re: Help me - GhostHacker - 06.08.2016

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.


Re: Help me - Shinja - 06.08.2016

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


Re: Help me - GhostHacker - 06.08.2016

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.


Re: Help me - Logic_ - 06.08.2016

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.


Re: Help me - GhostHacker - 06.08.2016

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 ?


Re: Help me - SyS - 06.08.2016

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


Re: Help me - Shinja - 06.08.2016

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