Good Detailed Stock Tutorials?
#7

stock is a code to make functions.

It won't send " Symbol is unused "strtok" " if you use stock.

Example :

pawn Code:
strtok( ... )
{
     return 1;
}
If you didn't use it, the compiler will sends a warning except if you use
pawn Code:
#pragma unused strtok
With stock, you can still add it without using it, without any warnings.
pawn Code:
stock strtok( ... )
{
    return 1;
}
Don't use timers or callbacks with stock, instead use forward( ); and public( )
pawn Code:
public OnGameModeInit( )
{
    SetTimer( "gmx", 3000, true );

    return 1;
}

stock gmx( ) // Wrong usage
    return GameModeExit( );

forward gmx( ); public gmx( ) // Correct usage
    return GameModeExit( );
I think wiki is enough.

& ( if you mean &&, scroll the page below ) signs means, you need to create it's own variable first, then use the function. Like :
pawn Code:
stock getName( playerid, &szName ) // idk, if it sends a error try &szName[ 24 ]
{
    GetPlayerName( playerid, szName, sizeof ( szName ) );

    return name; // forgot how to do this :P
}

// Somewhere
new
    name[ 24 ]
;

getName( playerid, name );

print( "%s", name );
About && sign, it means 'And'

Example:
pawn Code:
if ( ( getPlayerName( playerid ) == "Basicz" ) && ( strlen( getPlayerName( playerid ) ) == strlen( "Basicz" ) ) ) { // blablabla } // if playername == basicz and strlen playername == strlen " basicz "

if ( isANoob( playerid ) && GetPlayerMoney( playerid ) < 3500 )
    return Ban( playerid ); // if isanoob && getplayermoney < 3500
A simple one.

Not really advanced, but hope this can help you.

( Im a noob too :P But hope this can help you )
Reply


Messages In This Thread
Good Detailed Stock Tutorials? - by Rolyy - 05.08.2011, 11:23
Re: Good Detailed Stock Tutorials? - by Riddick94 - 05.08.2011, 11:24
Re: Good Detailed Stock Tutorials? - by Rolyy - 05.08.2011, 11:27
Re: Good Detailed Stock Tutorials? - by MadeMan - 05.08.2011, 11:54
Re: Good Detailed Stock Tutorials? - by wups - 05.08.2011, 11:57
Re: Good Detailed Stock Tutorials? - by Rolyy - 05.08.2011, 12:09
Re: Good Detailed Stock Tutorials? - by Basicz - 05.08.2011, 13:15
Re: Good Detailed Stock Tutorials? - by Lorenc_ - 05.08.2011, 13:25
Re: Good Detailed Stock Tutorials? - by Vince - 05.08.2011, 14:39

Forum Jump:


Users browsing this thread: 4 Guest(s)