Raised This Month: $32 Target: $400
 8% 

Scripting Tutorial


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Scarzzurs
Junior Member
Join Date: Mar 2004
Location: Denmark
Old 03-14-2004 , 07:30   Scripting Tutorial
Reply With Quote #1

Ok, Here is a Guide through the basic of scripting.

Tutorial.sma

Scarzzurs
Scarzzurs is offline
Send a message via MSN to Scarzzurs
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 03-14-2004 , 07:37  
Reply With Quote #2

you could say that basically every #include <aa> will be replaced be the content of file aa in the includes folder.

Maybe that tutorial would confuse people who are new to scirpting... i dont know.. we would have to test it on someone
__________________
hello, i am pm
PM is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 03-14-2004 , 07:43  
Reply With Quote #3

Code:
if (get_cvar_num("sv_c4players_special")){ // This lines opens up to some more lines, if the cvar "sv_c4players_special is set to a positive number.

I think negative values would count as true also. Actually only 0 counts as false, the rest are true.
Johnny got his gun is offline
Scarzzurs
Junior Member
Join Date: Mar 2004
Location: Denmark
Old 03-14-2004 , 10:30  
Reply With Quote #4

think?

I will have to test that then.... i just always thought it worked that way, lol

Scarzzurs
Scarzzurs is offline
Send a message via MSN to Scarzzurs
SniperBeamer
AMX Mod X Founder
Join Date: Jun 2003
Location: Good Old Europe
Old 03-14-2004 , 10:38  
Reply With Quote #5

Code:
#include <amxmod> // includes file called amxmod.inc. place this line in the top of the plugin.
it's amxmodx not amxmod


Code:
    return PLUGIN_CONTINUE // stops public.
has no effect
__________________
SniperBeamer is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 03-14-2004 , 10:45  
Reply With Quote #6

Quote:
Originally Posted by Scarzzurs
think?

I will have to test that then.... i just always thought it worked that way, lol

Scarzzurs
The difference is huge. like night and day :-)

Code:
    for (new i = -1; i < 2; i++) {         if (i)             server_print("%d is true", i)         else             server_print("%d is false", i)     }
generates this output:
Quote:
-1 is true
0 is false
1 is true
that's why I generally suggest natives should return 0 when they do not succeed. Error codes -1 and such is useless.
Johnny got his gun is offline
SniperBeamer
AMX Mod X Founder
Join Date: Jun 2003
Location: Good Old Europe
Old 03-14-2004 , 11:11  
Reply With Quote #7

I think everything <= 0 should be false
everything else is illogical
__________________
SniperBeamer is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 03-14-2004 , 11:13  
Reply With Quote #8

well i would also suggest returning 0 on error, but there are cases where thats not logical (for example functions that return an index into a C array)
__________________
hello, i am pm
PM is offline
ThorW634
Member
Join Date: Aug 2004
Location: Zeal
Old 03-14-2004 , 12:30  
Reply With Quote #9

very nice scarrzurz, gj
ThorW634 is offline
Send a message via AIM to ThorW634
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-14-2004 , 13:12   lol
Reply With Quote #10

Quote:
Originally Posted by SniperBeamer
I think everything <= 0 should be false
everything else is illogical
I Like the logical approach.. keeps it simple..
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
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

Forum Jump


All times are GMT -4. The time now is 11:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode