Trying to be better scripter.
#5

These symbols (or at least some of them) are related to general math/algebra.

Symbols:

&& : - This means and, in terms of PAWN, you could do 2 functions in 1 if statement. Example is below.
pawn Код:
if(IsPlayerConnected(playerid) && IsPlayerAdmin(playerid))
& : This I do not really know yet, but I do know a way you could use it. Example is below.
pawn Код:
if(newkeys & KEY_FIRE)
< : Less then, 1 < 5 - 1 is less then 5.
pawn Код:
if(PlayerInfo[playerid][Money] < GetPlayerMoney(playerid)) - //If their money is less then their client side money.
<< : I do not know yet.

>> : I do not know yet.

> : Greater then, 5 > 1 - 5 is greater then 1.
pawn Код:
if(GetPlayerMoney(playerid) > PlayerInfo[playerid][Money]) - //If their client side money is larger then their var money.
| : I do not know yet.

|| : This is like &&, but this is "or". You can use this for many things, such as strcmp.
pawn Код:
if(!strcmp(cmd, "/help", true) || !strcmp(cmd, "/h", true)) - //Comparing if they used /h or /help.
* : This is a math symbol, multiplication.
pawn Код:
75 * 3 - //Same thing as 75 x 3
- : This is a math symbol, subtraction. But this is used inside a function.
pawn Код:
300.0 - 250.0
-- : This is used to downgrade or subtract a variable.
pawn Код:
CountDown--;
= : This is a math symbol, basically equal to. It is used to assign a value to a var or array, etc.
pawn Код:
new Float:Health = 3000.0
== : This is a math symbol, similar to the equal sign, but instead, this is used to compare two functions/vars/arrays/etc.
pawn Код:
if(playerid == INVALID_PLAYER_ID) // This is used in a PM cmd, to see if they typed a invalid playerid.
+ : This is like subtraction, except, it is addition, you use it inside a function, to add numbers or variables/values.
pawn Код:
50.0 + 300.0
++ : This is like the subtraction sign for vars, but this is addition.
pawn Код:
CountDown++; //Will count upwards.
% : This is used to format a specifier, inside a format.
pawn Код:
%d - Whole Intenger | %s - string | %f - Float | %c - Single Character and more (search wiki)
>= : This is using the greater then, but also like assigning a var. This can be used to see a player's admin level in a if statement.
pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 4) // This will check if the person's level is 4 or higher.
<= : This is using the less then, but also like assigning a var. This can be used to see a player's admin level in a if statement.
pawn Код:
if(PlayerInfo[playerid][pAdmin] <= 4) // This will check if the person's level is 4 or lower.

-= : This is like the subtraction sign, except used for vars/arrays/enums etc.
pawn Код:
PlayerInfo[playerid][Money] -= amount;
+= : This is like the addition sign, except used for vars/arrays/enums etc.
pawn Код:
PlayerInfo[palyerid][Money] += amount;
Hope this helped.
Reply


Messages In This Thread
Trying to be better scripter. - by GaGlets(R) - 04.09.2010, 22:33
Re: Trying to be better scripter. - by woot - 04.09.2010, 22:39
Re: Trying to be better scripter. - by Thebest96 - 04.09.2010, 23:34
Re: Trying to be better scripter. - by LarzI - 04.09.2010, 23:39
Re: Trying to be better scripter. - by Toni - 05.09.2010, 00:16
Re: Trying to be better scripter. - by GaGlets(R) - 05.09.2010, 01:26
Re: Trying to be better scripter. - by Toni - 05.09.2010, 01:28
Re: Trying to be better scripter. - by RSX - 05.09.2010, 11:34
Re: Trying to be better scripter. - by Toni - 05.09.2010, 15:24
Re: Trying to be better scripter. - by Nero_3D - 05.09.2010, 17:57

Forum Jump:


Users browsing this thread: 5 Guest(s)