Help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help (
/showthread.php?tid=634679)
Help -
FizzyWalshy - 24.05.2017
Remove -Fixed.
Re: Help -
StevenLV - 24.05.2017
is it }evel 3 or }level 3
Re: Help -
DarkSkull - 24.05.2017
Pretty sure that evel 3 isn't supposed to be there
Also, It is better to make the returns in line as it will reduce the number of lines and makes it easier to read the code. You don't have to worry about missing curly brackets either.
PHP код:
CMD:dicebet(playerid, params[])
{
new targetid, amount;
if(PlayerInfo[playerid][pLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You need to have 100+ score in order to dice bet.");
if(sscanf(params, "ui", targetid, amount)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[Usage]: /dicebet [playerid] [amount]");
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 SendClientMessageFormatted(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();
SendClientMessageFormatted(targetid, COLOR_AQUA, "** %s has initiated a dice bet with you for $%i (/accept dicebet).", GetPlayerNameEx(playerid), amount);
SendClientMessageFormatted(playerid, COLOR_AQUA, "** You have initiated a dice bet against %s for $%i.", GetPlayerNameEx(targetid), amount);
return 1;
}
Re: Help -
CheezIt - 24.05.2017
Quote:
Originally Posted by DarkSkull
Pretty sure that evel 3 isn't supposed to be there
Also, It is better to make the returns in line as it will reduce the number of lines and makes it easier to read the code. You don't have to worry about missing curly brackets either.
PHP код:
CMD:dicebet(playerid, params[])
{
new targetid, amount;
if(PlayerInfo[playerid][pLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You need to have 100+ score in order to dice bet.");
if(sscanf(params, "ui", targetid, amount)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[Usage]: /dicebet [playerid] [amount]");
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 SendClientMessageFormatted(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();
SendClientMessageFormatted(targetid, COLOR_AQUA, "** %s has initiated a dice bet with you for $%i (/accept dicebet).", GetPlayerNameEx(playerid), amount);
SendClientMessageFormatted(playerid, COLOR_AQUA, "** You have initiated a dice bet against %s for $%i.", GetPlayerNameEx(targetid), amount);
return 1;
}
|
It's honestly more readable the other way around, especially with the word-wrap setting in Sublime Text. But I'd say that this is debatable and that it's mainly a personal preference.
Quote:
Originally Posted by FizzyWalshy
So i have a dicebet game for my freeroam but when i dicebet him nothing show to me and from him this is the code
|
My guess is that there's probably an issue with the function SendClientMessageFormatted since you say that "nothing shows".