AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [TUT] SourcePawn Scripting - Tips, Basics to Advanced (https://forums.alliedmods.net/showthread.php?t=321089)

Dragokas 12-03-2020 13:59

Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
 
Addition for "3. Connect to Server" section.

Recently, they updated something in security, and a method for running client via left4dead2.exe (with arguments) in the same machine with a server is no more working.

Instead, here is a walkaround to run the app directly from steam.exe.
I'm attaching the full code of .bat script (to run server + join simultaneously):

Spoiler


For other games, change appID 550 by your game's Id from steam.inf file, and GAME_ALIAS value with an appropriate game name alias.

Dragokas 01-10-2021 14:38

Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
 
Published Russian translation of the article, with some additions:

Spoiler

Uncle Jessie 04-04-2021 04:52

Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
 
Something like this is useful too
Using this script instead of the random start map plugins

Spoiler

Dragokas 04-09-2021 08:43

Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
 
Half-Life Position, Velocity, and Angles (for n00bs)

Mystik Spiral 07-05-2021 16:11

Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
 
On the first page, in section...

...and subheading...

Code:

SourcePawn specific editors
...please consider adding a link for...

Code:

SPCode - fork of SPEdit which aims to fix issues and add some small features

Silvers 07-06-2021 05:05

Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
 
Done. Thanks.

little_froy 08-19-2021 09:44

Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
 
strcmp() provides less readable and worse compatibility compared to StrContains()

MAGNAT2645 08-19-2021 14:17

Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
 
You can also mention the "stringize" operator (inherited from Pawn) which converts arguments to packed strings in a macro.
I don't find it that useful but still here's an example:
Code:

// Note that spaces inside parentheses count too!!! STRINGIZE( abc123 ) = " abc123 "
#define STRINGIZE(%0) #%0

ConVar myplugin_enabled; // typical toggle convar

Action ServerCmd_DoStuff(int args) {
        if ( !myplugin_enabled.BoolValue ) {
                PrintToServer( "Plugin is disabled! " ... STRINGIZE(myplugin_enabled) ... " = 0" ); // "Plugin is disabled! myplugin_enabled = 0"
                return Plugin_Handled;
        }

        // ...

        return Plugin_Handled;
}


Dragokas 08-20-2021 10:00

Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
 
Quote:

Originally Posted by little_froy (Post 2755614)
strcmp() provides less readable and worse compatibility compared to StrContains()

What kind of compatibility are you talking about?
These functions have different meanings.

MAGNAT2645, interesting ability, but IMHO, useless sample =) Can't find where it could be useful. The same can be written by manual string enquoting.

Psyk0tik 08-20-2021 10:38

Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
 
Quote:

Originally Posted by little_froy (Post 2755614)
strcmp() provides less readable and worse compatibility compared to StrContains()

Judging by the context of how "strcmp" is referenced in the main post, I would assume that you think "StrContains" is more "readable" and has better "compatibility" when it comes to comparing two strings, which is completely false and irrelevant to the purpose of "strcmp"/"StrEqual". The "StrContains" function checks if a string contains a substring, whereas "strcmp"/"StrEqual" compares two strings to determine if they are equal. Just because a string may contain a substring that starts at index 0, doesn't mean that the string is equal to the substring.


All times are GMT -4. The time now is 22:27.

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