How to make this as filter script
#2

When you start a new script it tells you :
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}
#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif
Meaning that if you want to make this script a FILTERSCRIPT, uncomment the #define filterscript, to be declared as a filterscript thus it will call onfilterscriptinit, exit functions instead of main() which is for gamemode.

However here is what you want:
pawn Код:
#include <a_samp>
#include <zcmd>//re-define your prefered command processor here.

CMD:dicebet(playerid, params[])
{
    new targetid, amount;

    if(!IsPlayerInRangeOfPoint(playerid, 50.0, 1099.8420, 20.3554, 1000.6797))
    {
        return SendClientMessage(playerid, COLOR_GREY, "You are not in range of the casino.");
    }
    if(PlayerInfo[playerid][pLevel] < 3)
    {
        return SendClientMessage(playerid, COLOR_GREY, "You need to be at least level 3+ in order to dice bet.");
    }
    if(sscanf(params, "ui", targetid, amount))
    {
        return SendClientMessage(playerid, COLOR_GREY3, "[Usage]: /dicebet [playerid] [amount]");
    }
    if(!IsPlayerConnected(targetid) || !IsPlayerInRangeOfPlayer(playerid, targetid, 5.0))
    {
        return SendClientMessage(playerid, COLOR_GREY, "The player specified is disconnected or out of range.");
    }
    if(targetid == playerid)
    {
        return SendClientMessage(playerid, COLOR_GREY, "You can't use this command on yourself.");
    }
    if(PlayerInfo[targetid][pLevel] < 3)
    {
        return SendClientMessage(playerid, COLOR_GREY, "That player must be at least level 3+ to bet with them.");
    }
    if(amount < 1)
    {
        return SendClientMessage(playerid, COLOR_GREY, "The amount can't be below $1.");
    }
    if(PlayerInfo[playerid][pCash] < amount)
    {
        return SendClientMessage(playerid, COLOR_GREY, "You don't have that much money to bet.");
    }
    if(gettime() - PlayerInfo[playerid][pLastBet] < 10)
    {
        return SendClientMessageEx(playerid, COLOR_GREY, "You can only use this command every 10 seconds. Please wait %i more seconds.", 10 - (gettime() - PlayerInfo[playerid][pLastBet]));
    }

    PlayerInfo[targetid][pDiceOffer] = playerid;
    PlayerInfo[targetid][pDiceBet] = amount;
    PlayerInfo[playerid][pLastBet] = gettime();

    SendClientMessageEx(targetid, COLOR_AQUA, "** %s has initiated a dice bet with you for $%i (/accept dicebet).", GetPlayerRPName(playerid), amount);
    SendClientMessageEx(playerid, COLOR_AQUA, "** You have initiated a dice bet against %s for $%i.", GetPlayerRPName(targetid), amount);
    return 1;
}

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" FILTERSCRIPT. is loaded");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}
Reply


Messages In This Thread
How to make this as filter script - by FizzyWalshy - 28.01.2017, 08:16
Re: How to make this as filter script - by SilentSoul - 28.01.2017, 08:42
Re: How to make this as filter script - by FizzyWalshy - 28.01.2017, 09:08

Forum Jump:


Users browsing this thread: 1 Guest(s)