28.01.2017, 08:42
When you start a new script it tells you :
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:
Код:
// 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
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;
}