Help for creating a VIP commands
#3

Filterscript:
pawn Код:
// Add the saving system yourself, I am just going to do vars + commands + spawn weapons and money.

#include < a_samp >
#include < zcmd > // You need ZCMD for this.
#include < sscanf2 > // You also need SSCANF2 include + plugin for this.

#define VIP_SILVER 1
#define VIP_GOLD   2

CMD:setvip( playerid, params[ ] ) {
    if( !IsPlayerAdmin( playerid ) )
        return SendClientMessage( playerid, -1, "You need to be a RCON admin to use this. " ); // You need to be RCON to set someone's VIP
    new
        id,
        vip
    ;
    if( sscanf( params, "ud", id, vip ) )
        return SendClientMessage( playerid, -1, "USAGE: /setvip [ID] [1 for silver, 2 for gold, 0 if you want to remove VIP]. " );
    if( !IsPlayerConnected( id ) || id == INVALID_PLAYER_ID )
        return SendClientMessage( playerid, -1, "Invalid player ID (player not connected). " );
    if( vip > 2 || vip < 0 )  
        return SendClientMessage( playerid, -1, "The VIP rank must be between 0 and 2. " );
    SetPVarInt( id, "VIP", vip );
    new
        str[ 128 ],
        pName[ 24 ],
        aName[ 24 ],
        vipstr[ 8 ]
    ;
    if( vip == 0 )
        vipstr = "none";
    if( vip == 1 )
        vipstr = "silver";
    if( vip == 2 )
        vipstr = "gold";
    GetPlayerName( id, pName, 24 );
    GetPlayerName( playerid, aName, 24 );
    format( str, sizeof str, "RCON administrator %s has set your donor rank to %s", aName, vipstr );
    SendClientMessage( id, -1, str );
    format( str, sizepf str, "You have set %s's donor rank to %s", pName, vipstr );
    return SendClientMessage( playerid, -1, str );
}

CMD:healme( playerid, params[ ] ) {
    if( GetPVarInt( playerid, "VIP" ) < 1 )
        return SendClientMessage( playerid, -1, "You need to be VIP silver/gold to use this. " );
    SetPlayerHealth( playerid, 100.0 );
    return SendClientMessage( playerid, -1, "You healed yourself. " );
}

CMD:getarmour( playerid, params[ ] ) {
    if( GetPVarInt( playerid, "VIP" ) < 1 )
        return SendClientMessage( playerid, -1, "You need to be VIP silver/gold to use this. " );
    SetPlayerArmour( playerid, 100.0 );
    return SendClientMessage( playerid, -1, "You armoured yourself. " );
}


public OnPlayerSpawn( playerid ) {
    switch( GetPVarInt( playerid, "VIP" ) ) {
        case VIP_SILVER: {
            GivePlayerWeapon( playerid, 38, 50 );
            GivePlayerWeapon( playerid, 34, 25 );
            GivePlayerWeapon( playerid, 31, 250 );
            GivePlayerWeapon( playerid, 41, 400 );
            GivePlayerWeapon( playerid, 24, 200 );
            GivePlayerWeapon( playerid, 26, 70 );
            GivePlayerWeapon( playerid, 28, 150 );
        }
        case VIP_GOLD: {
            GivePlayerWeapon( playerid, 38, 100 );
            GivePlayerWeapon( playerid, 34, 50 );
            GivePlayerWeapon( playerid, 31, 550 );
            GivePlayerWeapon( playerid, 41, 600 );
            GivePlayerWeapon( playerid, 24, 500 );
            GivePlayerWeapon( playerid, 26, 120 );
            GivePlayerWeapon( playerid, 28, 300 );
            GivePlayerWeapon( playerid, 18, 10 );
            GivePlayerMoney( playerid, 200 );
        }
    }
    return 1;
}

public OnPlayerDisconnect( playerid ) {
    DeletePVar( playerid, "VIP" );
}
Untested, note that I worked around 20 minutes on this. Also, I didn't add "/mob" because I don't know what a baril is...

You need to add saving system yourself to save player's VIP to file.
Reply


Messages In This Thread
Help for creating a VIP commands - by ServerScripter - 03.07.2011, 19:53
Re: Help for creating a VIP commands - by Bakr - 03.07.2011, 19:58
Re: Help for creating a VIP commands - by Mean - 03.07.2011, 20:17
Re : Help for creating a VIP commands - by ServerScripter - 03.07.2011, 20:36
Re : Help for creating a VIP commands - by ServerScripter - 04.07.2011, 08:54
Re: Help for creating a VIP commands - by Wesley221 - 04.07.2011, 08:58
Re : Help for creating a VIP commands - by ServerScripter - 04.07.2011, 09:01

Forum Jump:


Users browsing this thread: 5 Guest(s)