SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Discussion

Reply
 
Thread Tools Display Modes
Old 21/07/2012, 12:35 AM   #21
milanosie
High-roller
 
milanosie's Avatar
 
Join Date: Dec 2011
Location: Amsterdam, Netherlands
Posts: 2,216
Reputation: 379
Default Re: Today I learned - Share your newly found knowledge!

Today I learned that the bone structure of skin Id 267 Officer Jimmy Hernandez Is fucked up.
milanosie is offline   Reply With Quote
Old 21/07/2012, 10:57 AM   #22
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,975
Reputation: 2649
Default Re: Today I learned - Share your newly found knowledge!

Today I learned that the name of an enum also defines its total size.
__________________
Vince is offline   Reply With Quote
Old 22/07/2012, 02:09 AM   #23
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 3,739
Reputation: 646
Default AW: Re: Today I learned - Share your newly found knowledge!

Quote:
Originally Posted by Vince View Post
Today I learned that the name of an enum also defines its total size.
Only if you use the default increment (+= 1)

Today I learned that NOP's are slower than no code
Nero_3D is offline   Reply With Quote
Old 22/07/2012, 10:32 AM   #24
Niko_boy
High-roller
 
Niko_boy's Avatar
 
Join Date: Aug 2010
Location: Somewhere i belong
Posts: 1,423
Reputation: 138
Default Re: Today I learned - Share your newly found knowledge!

Today i learnt that you can use 0 < Var < 5 instead of Var > 0 && Var < 5
<meh was so ez>
__________________
nope[IMG]http://*******/1r0SOkH_[/IMG]
•••[CLOSED]LCS•Freeroam•DM•Stunts•••AutoArena [0.3z][No SkinShot][sixtytiger.com]Want a decent Attack Defend Gamemode?
N/A176.31.229.148:7830Get This! Attack-Defend(v2.3.1)
Niko_boy is offline   Reply With Quote
Old 22/07/2012, 02:49 PM   #25
MrDeath537
High-roller
 
Join Date: Nov 2009
Location: Argentina
Posts: 2,007
Reputation: 29
Default Re: Today I learned - Share your newly found knowledge!

Today I learned how to use the '%' operator!
It gives you the rest of a division, for example:
pawn Code:
9 / 4 // This will give you 2
9 % 4 // This will give you 1
__________________
Sometimes I return.
MrDeath537 is offline   Reply With Quote
Old 22/07/2012, 05:15 PM   #26
JoBullet
Big Clucker
 
Join Date: Mar 2012
Posts: 59
Reputation: 100
Default Re: Today I learned - Share your newly found knowledge!

The '%'(modulus) operator returns remainder of division.
JoBullet is offline   Reply With Quote
Old 22/07/2012, 06:11 PM   #27
Sasino97
High-roller
 
Sasino97's Avatar
 
Join Date: Dec 2010
Location: Italy
Posts: 1,445
Reputation: 106
Default Re: Today I learned - Share your newly found knowledge!

Quote:
Originally Posted by Niko_boy View Post
Today i learnt that you can use 0 < Var < 5 instead of Var > 0 && Var < 5
<meh was so ez>
I studied that way of writing (x < y < z means y is between x and z) at school, but I discovered that you can use it in Pawn and in some other languages very recently.
Sasino97 is online now   Reply With Quote
Old 22/07/2012, 07:22 PM   #28
Slice
High-roller
 
Join Date: Mar 2008
Location: Sweden
Posts: 1,896
Reputation: 1590
Default Re: Today I learned - Share your newly found knowledge!

Today I learned getdate(&year=0, &month=0, &day=0) returns the current day of the year (i.e. 5th of febuary is the 36th day).
Slice is offline   Reply With Quote
Old 22/07/2012, 07:38 PM   #29
Matz
Huge Clucker
 
Matz's Avatar
 
Join Date: Apr 2011
Location: Istanbul
Posts: 260
Reputation: 141
Default Re: Today I learned - Share your newly found knowledge!

Today I learned ;
pawn Code:
new Float:vec[3]; GetPlayerPos(playerid,vec[0],vec[1],vec[2]);
instead of
pawn Code:
new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid,X,Y,Z);
Matz is offline   Reply With Quote
Old 23/07/2012, 11:22 AM   #30
Slice
High-roller
 
Join Date: Mar 2008
Location: Sweden
Posts: 1,896
Reputation: 1590
Default Re: Today I learned - Share your newly found knowledge!

Today I learned because of compiler bug, you can place entries in the public functions table by doing this:
pawn Code:
forward public SomeFunction();
SomeFunction(){}
Not one extra instruction of code will be inside the AMX.
Slice is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Things you learned from GTA SA Toni Everything and Nothing 212 20/08/2011 07:07 AM
How you learned to script Bam23 Help Archive 9 11/04/2011 10:21 AM
What did u learned today ? rafay Everything and Nothing 170 30/03/2010 04:06 PM


All times are GMT. The time now is 01:29 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.