How to make this as filter script
#1

Remove -Fixed.
Reply
#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
#3

Where should i put this code ?

Код:
else if(!strcmp(params, "dicebet", true))
	{
	    new
			offeredby = PlayerInfo[playerid][pDiceOffer],
			amount = PlayerInfo[playerid][pDiceBet];

	    if(offeredby == INVALID_PLAYER_ID)
	    {
	        return SendClientMessage(playerid, COLOR_GREY, "You haven't received any offers for dice betting.");
	    }
	    if(!IsPlayerInRangeOfPlayer(playerid, offeredby, 5.0))
		{
	        return SendClientMessage(playerid, COLOR_GREY, "The player who initiated the offer is out of range.");
	    }
	    if(PlayerInfo[playerid][pCash] < amount)
	    {
	        return SendClientMessage(playerid, COLOR_GREY, "You can't afford to accept this bet.");
	    }
	    if(PlayerInfo[offeredby][pCash] < amount)
	    {
	        return SendClientMessage(playerid, COLOR_GREY, "That player can't afford to accept this bet.");
	    }

		new
			rand[2];

		rand[0] = random(6) + 1;
		rand[1] = random(6) + 1;

		SendProximityMessage(offeredby, 20.0, COLOR_WHITE, "** %s rolls a dice which lands on the number %i.", GetPlayerRPName(offeredby), rand[0]);
		SendProximityMessage(playerid, 20.0, COLOR_WHITE, "** %s rolls a dice which lands on the number %i.", GetPlayerRPName(playerid), rand[1]);

		if(rand[0] > rand[1])
		{
		    GivePlayerCash(offeredby, amount);
		    GivePlayerCash(playerid, -amount);

		    SendClientMessageEx(offeredby, COLOR_AQUA, "** You have won $%i from your dice bet with %s.", amount, GetPlayerRPName(playerid));
		    SendClientMessageEx(playerid, COLOR_RED, "** You have lost $%i from your dice bet with %s.", amount, GetPlayerRPName(offeredby));

			if(amount > 10000 && !strcmp(GetPlayerIP(offeredby), GetPlayerIP(playerid)))
			{
				SendAdminMessage(COLOR_YELLOW, "AdmWarning: %s (IP: %s) won a $%i dice bet against %s (IP: %s).", GetPlayerRPName(offeredby), GetPlayerIP(offeredby), amount, GetPlayerRPName(playerid), GetPlayerIP(playerid));
			}
		}
		else if(rand[0] == rand[1])
		{
			SendClientMessageEx(offeredby, COLOR_AQUA, "** The bet of $%i was a tie. You kept your money as a result!", amount);
		    SendClientMessageEx(playerid, COLOR_AQUA, "** The bet of $%i was a tie. You kept your money as a result!", amount);
		}
		else
		{
		    GivePlayerCash(offeredby, -amount);
		    GivePlayerCash(playerid, amount);

		    SendClientMessageEx(playerid, COLOR_AQUA, "** You have won $%i from your dice bet with %s.", amount, GetPlayerRPName(offeredby));
		    SendClientMessageEx(offeredby, COLOR_RED, "** You have lost $%i from your dice bet with %s.", amount, GetPlayerRPName(playerid));

			if(amount > 10000 && !strcmp(GetPlayerIP(offeredby), GetPlayerIP(playerid)))
			{
				SendAdminMessage(COLOR_YELLOW, "AdmWarning: %s (IP: %s) won a $%i dice bet against %s (IP: %s).", GetPlayerRPName(playerid), GetPlayerIP(playerid), amount, GetPlayerRPName(offeredby), GetPlayerIP(offeredby));
			}
		}

	    PlayerInfo[playerid][pDiceOffer] = INVALID_PLAYER_ID;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)