SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 26/01/2011, 06:52 PM   #21
ipsBruno
Godfather
 
ipsBruno's Avatar
 
Join Date: Apr 2010
Location: Brazil, Caxias RS
Posts: 6,087
Reputation: 545
Default Respuesta: Tips & Tricks

pawn Code:
public OnFilterScriptInit()
{
    new zL[] = "²£¢¬¢¢*abcdefghijklmnopqrstuvxzwy ",s[12],zValue = - 1;
    for(new i; zL[i]; ++i) { zValue = (zL[i]  == 0x69) ? (s[0] = zL[i]) : (s[0] = '0');      if(zL[i] == 0x69) break; }
    for(new i; zL[i]; ++i) { zValue = (zL[i]  == 0x20) ? (s[1] = zL[i]) : (s[1] = '0');      if(zL[i] == 0x20) break; }
    for(new i; zL[i]; ++i) { zValue = (zL[i]  == 0x6C) ? (s[2] = zL[i]) : (s[2] = '0');      if(zL[i] == 0x6C) break; }
    for(new i; zL[i]; ++i) { zValue = (zL[i]  == 0x6F) ? (s[3] = zL[i]) : (s[3] = '0');      if(zL[i] == 0x6F) break; }
    for(new i; zL[i]; ++i) { zValue = (zL[i]  == 0x76) ? (s[4] = zL[i]) : (s[4] = '0');      if(zL[i] == 0x76) break; }
    for(new i; zL[i]; ++i) { zValue = (zL[i]  == 0x65) ? (s[5] = zL[i]) : (s[5] = '0');      if(zL[i] == 0x65) break; }
    for(new i; zL[i]; ++i) { zValue = (zL[i]  == 0x20) ? (s[6] = zL[i]) : (s[6] = '0');      if(zL[i] == 0x20) break; }
    for(new i; zL[i]; ++i) { zValue = (zL[i]  == 0x61) ? (s[7] = zL[i]) : (s[7] = '0');      if(zL[i] == 0x61) break; }
    for(new i; zL[i]; ++i) { zValue = (zL[i]  == 0x6C) ? (s[8] = zL[i]) : (s[8] = '0');      if(zL[i] == 0x6C) break; }
    for(new i; zL[i]; ++i) { zValue = (zL[i]  == 0x6C) ? (s[9] = zL[i]) : (s[9] = '0');      if(zL[i] == 0x6C) break; }
    printf(s,zValue);
    return true;
}

I Love all '-'-'-'

My code is nb
__________________
Baixar Músicas Grátis
ipsBruno is offline   Reply With Quote
Old 27/01/2011, 01:20 AM   #22
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,803
Reputation: 1160
Default Re: Tips & Tricks

Thanks for posting, needed some info on the "[MAX_PLAYERS char]" thing
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline   Reply With Quote
Old 27/01/2011, 07:28 AM   #23
[03]Garsino
Guest
 
Posts: n/a
Default Re: Tips & Tricks

Any way to do the "Char-arrays" trick using 2D arrays?

pawn Code:
new MuteTime[MAX_PLAYERS][2];
  Reply With Quote
Old 27/01/2011, 10:44 AM   #24
Slice
High-roller
 
Join Date: Mar 2008
Location: Sweden
Posts: 1,835
Reputation: 1607
Default Re: Tips & Tricks

@[03]Garsino:
pawn Code:
new MuteTime[MAX_PLAYERS][2 char];

MuteTime[playerid]{0} = 1;
MuteTime[playerid]{1} = 1;

@******:
Interesting post, now I finally know how the stringize operator thinks! I did point out that you have to enclose strings in parentheses, actually.
I'll squeeze in the part about the TD update functionality.
Slice is offline   Reply With Quote
Old 27/01/2011, 11:32 AM   #25
Zh3r0
High-roller
 
Join Date: Mar 2008
Posts: 4,513
Reputation: 398
Default Re: Tips & Tricks

Wow just gota say millions of thanks, just learned more about the ternary operators, and mostly everything u wrote is useful.

good job Slice, once again, good job.

I had such a nice scripting time

http://pastebin.com/DcUpcqVD
__________________

Last edited by Zh3r0; 27/01/2011 at 12:29 PM.
Zh3r0 is offline   Reply With Quote
Old 28/01/2011, 12:49 PM   #26
CyNiC
High-roller
 
Join Date: Jan 2009
Location: Brazil
Posts: 1,419
Reputation: 203
Default Re: Tips & Tricks

Very good, Slice, I have no formation in any programming language, these things are not easy to find around, thanks.
__________________
My scripts
Brazucas'Server
CyNiC is offline   Reply With Quote
Old 28/01/2011, 06:13 PM   #27
ricardo178
High-roller
 
ricardo178's Avatar
 
Join Date: Dec 2010
Posts: 1,598
Reputation: 91
Default Re: Tips & Tricks

Hum... if this is a TUT why haven't explain words?
ricardo178 is offline   Reply With Quote
Old 31/01/2011, 09:34 PM   #28
MrDeath537
High-roller
 
Join Date: Nov 2009
Location: Argentina
Posts: 1,959
Reputation: 29
Default Re: Tips & Tricks

Nice tutorial, most of those things I already knew, but:

- I didn't know how to use ternary operator (LOL)
- How to convert integer to boolean using "!!"
- The usage of brackets in char arrays.


Thanks for tutorial!
__________________
Sometimes I return.
MrDeath537 is offline   Reply With Quote
Old 01/02/2011, 02:59 AM   #29
ipsBruno
Godfather
 
ipsBruno's Avatar
 
Join Date: Apr 2010
Location: Brazil, Caxias RS
Posts: 6,087
Reputation: 545
Default Respuesta: Tips & Tricks

Slice, put in Tutorial


~=
^=
|=
_:


Hugs
__________________
Baixar Músicas Grátis
ipsBruno is offline   Reply With Quote
Old 01/02/2011, 07:47 AM   #30
Slice
High-roller
 
Join Date: Mar 2008
Location: Sweden
Posts: 1,835
Reputation: 1607
Default Re: Tips & Tricks

DraKiNs, here's a tutorial explaining the first 3 operators: An in-depth look at binary and binary operators.

The _: operator removes tags from variables/values.

Last edited by Slice; 05/02/2011 at 08:01 AM.
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
Needs Scripting Tips! KomplettMaster General 12 26/12/2012 04:04 PM
[Tutorial] [InfiniTuts - Tutorials for beginners] Tips and Tricks regarding 'logical thinking' - Making your own script Infinity Tutorials 6 29/04/2012 11:34 PM


All times are GMT. The time now is 02:24 AM.


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