26.01.2011, 17:38
@Hiddos:
Put this in a FS and load it.
Win.
Also, I broke down your ternary and noticed an error that I fixed - try this:
@[FeK]DraKiNs:
In PAWN it\'s different, there\'s no difference in speed if you\'re using ++i or i++ and using its value - there is a slight difference in the resulting assembly code, though.
If you\'re not using the value from the variable you\'re incrementing (like in a for loop), ++i and i++ are the exact same things.
Is exactly the same as:
If you don\'t believe me, run the PAWN compiler with the additional -a in the command line to see the assembly output.
Put this in a FS and load it.
pawn Code:
#include <a_samp>
public OnFilterScriptInit()
for(new c[]="osudrlnfaYAI tvciy\'mW
gwehk",i=2,s[146],y[2];i>1;i++)
y[0]=c[i<3?21:i<4?21:i<5?21:i<6?20:i<7?24:i<8?18:i<9?4:i<10?24:i<11?12:i<12?6:i<13?0:i<14?12:i<15?1:i<16?13:i<17?4:i<18?8:i<19?6:i<20?22:i<21?24:i<22?4:i<23?1:i<24?12:i<25?13:i<26?0:i<27?12:i<28?5:i<29?0:i<30?14:i<31?24:i<32?21:i<33?9:i<34?0:i<35?2:i<36?12:i<37?26:i<38?6:i<39?0:i<40?23:i<41?12:i<42?13:i<43?25:i<44?24:i<45?12:i<46?4:i<47?2:i<48?5:i<49?24:i<50?1:i<51?12:i<52?8:i<53?6:i<54?3:i<55?12:i<56?1:i<57?0:i<58?12:i<59?3:i<60?0:i<61?12:i<62?11:i<63?21:i<64?10:i<65?12:i<66?7:
i<67?2:i<68?5:i<69?5:i<70?12:i<71?15:i<72?0:i<73?19:i<74?19:i<75?16:i<76?13:i<77?19:i<78?24:i<79?6:i<80?13:i<81?18:i<82?1:i<83?12:i<84?23:i<85?25:i<86?8:i<87?13:i<88?12:i<89?11:i<90?18:i<91?19:i<92?12:i<93?13:i<94?25:i<95?16:i<96?6:i<97?26:i<98?16:i<99?6:i<100?22:i<101?12:i<102?0:i<103?7:i<104?21:i<105?9:i<106?0:i<107?2:i<108?12:i<109?23:i<110?0:i<111?2:i<112?5:i<113?3:i<114?6:i<115?18:i<116?13:i<117?12:i<118?22:i<119?24:i<120?13:i<121?12:i<122?13:i<123?25:i<124?16:i<125?1:
i<126?12:i<127?7:i<128?4:i<129?0:i<130?19:i<131?12:i<132?8:i<133?6:i<134?17:i<135?12:i<136?0:i<137?13:i<138?25:i<139?24:i<140?4:i<141?12:i<142?22:i<143?2:i<144?17:i<145?21:i<146?21:i<147?21:print(s)?(i=0):(i=0)],strcat(s,y);
Also, I broke down your ternary and noticed an error that I fixed - try this:
pawn Code:
Pos[0] +=
(
( Keys[2] > 0 )
? (
( Keys[0] & KEY_SPRINT )
? (
( Keys[0] & KEY_JUMP )
? ( 5.4 )
: ( 3.6 ) )
: (
( Keys[0] & KEY_JUMP )
? ( 2.7 )
: ( 1.8 ) )
)
: (
( Keys[2] < 0 )
? (
( Keys[0] & KEY_SPRINT )
? (
( Keys[0] & KEY_JUMP )
? ( -5.4 ) : ( -3.6 ) )
: (
(Keys[0] & KEY_JUMP)
? ( -2.7 ) : ( -1.8 ) )
)
: ( 0.0 )
)
)
;
@[FeK]DraKiNs:
In PAWN it\'s different, there\'s no difference in speed if you\'re using ++i or i++ and using its value - there is a slight difference in the resulting assembly code, though.
If you\'re not using the value from the variable you\'re incrementing (like in a for loop), ++i and i++ are the exact same things.
pawn Code:
for ( new i = 0, l = strlen( string ); i != l; i++ )
pawn Code:
for ( new i = 0, l = strlen( string ); i != l; ++i )
If you don\'t believe me, run the PAWN compiler with the additional -a in the command line to see the assembly output.