SA-MP Forums Archive
Dice - 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: Dice (/showthread.php?tid=614082)



Dice - Rix70 - 04.08.2016

Hello Guys! Can you give me a script of dice? that command is, Check below

"/accept dicebet" and "/dicebet"

When you /dicebet them, it said (/dicebet [id] [ammount]) and if he accept it and it will automatically roll the dice and someone will win with dicebet price


Re: Dice - Rix70 - 04.08.2016

and the guys who win like bet 1m and then guy who win 2m and guy who lose lose 1m simple, and max dice 36m


Re: Dice - Shinja - 04.08.2016

This is Scripting Help section not for Requesting, do some effort and we can help you if you got errors


Re: Dice - Rix70 - 04.08.2016

can u just do it for me pls i cant script i am wroth less i treid thousands of times


Re: Dice - SickAttack - 04.08.2016

Post in looking for scripters/helpers topic. Follow the rules.


Re: Dice - Shinja - 04.08.2016

Ok i did it for you this time, np
PHP код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>

new Bet[MAX_PLAYERS], Invited[MAX_PLAYERS], Dicetimer[MAX_PLAYERS], Guess[MAX_PLAYERS];
forward CancelBet(playerid);
public 
CancelBet(playerid)
{
    
Bet[playerid] = 0;
    
Invited[playerid] = 0;
    
Guess[playerid] = 0;
    
SendClientMessage(playerid, -1"Dice bet invitation canceled. [15 Seconds passed]");
}

CMD:diceinvite(playeridparams[])
{
    new 
idbetguessname[25], string[100];
    
GetPlayerName(playeridname25);
    if(
sscanf(params"ui"idbetguess)) return SendClientMessage(playerid, -1"{0008F7}USAGE: {FFFFFF}/DICEBET ID BET YOUR_GUESS[1-6]");
    if(!
IsPlayerConnected(id)) return SendClientMessage(playerid, -1"Player is not connected");
    if(
GetPlayerMoney(playerid) < bet) return SendClientMessage(playerid, -1"You cannot affrod this ammount");
    if(
GetPlayerMoney(id) < bet) return SendClientMessage(playerid, -1"Player cannot affrod this ammount");
    if(
guess || guess 6) return SendClientMessage(playerid, -1"Invalid guess. [1-6]");
    
format(string100"Dice Bet invitation from %s Price $%d. His guess %d. /DICEACCEPT YOUR_GUESS to accept it."namebetguess);
    
SendClientMessage(id, -1string);
    
SendClientMessage(playerid, -1"Dice bet invitation Sent!");
    
Bet[playerid] = bet;
    
Bet[id] = bet;
    
Invited[playerid] = id;
    
Invited[id] = playerid;
    
Guess[playerid] = guess;
    
Dicetimer[playerid] = SetTimerEx("CancelBet"15000false"i"playerid);
    
Dicetimer[id] = SetTimerEx("CancelBet"15000false"i"id);
    return 
1;
}

CMD:diceaccept(playeridparams[])
{
    new 
guessname[25], iname[25], string[100];
    
GetPlayerName(playeridname25);
    if(
sscanf(params"i"guess)) return SendClientMessage(playerid, -1"{0008F7}USAGE: {FFFFFF}/DICEACCEPT YOUR_GUESS[1-6]");
    if(
Invited[playerid] == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1"Player disconnected or your not invited to any Dicebet");
    if(
guess || guess 6) return SendClientMessage(playerid, -1"Invalid guess. [1-6]");
    
GetPlayerName(Invited[playerid], iname25);
    
KillTimer(Dicetimer[playerid]);
    
KillTimer(Dicetimer[Invited[playerid]]);
    new 
rand random(5);
    if(
rand == Guess[playerid]-1)
    {
        
format(string100"%s have won the Dicebet against %s and won %d"nameinameBet[playerid]);
        
SendClientMessageToAll(-1string);
        
GivePlayerMoney(playeridBet[playerid]);
        
GivePlayerMoney(Invited[playerid], -Bet[playerid]);
    }
    else if(
rand == Guess[Invited[playerid]]-1)
    {
        
format(string100"%s have won the Dicebet against %s and won %d"inamenameBet[playerid]);
        
SendClientMessageToAll(-1string);
        
GivePlayerMoney(playerid, -Bet[playerid]);
        
GivePlayerMoney(Invited[playerid], Bet[playerid]);
    }
    else 
SendClientMessage(playerid, -1"No one won!"), SendClientMessage(Invited[playerid], -1"No one won!");
    
Bet[playerid] = 0;
    
Invited[playerid] = 0;
    
Guess[playerid] = 0;
    
Bet[Invited[playerid]] = 0;
    
Invited[Invited[playerid]] = 0;
    
Guess[Invited[playerid]] = 0;
    return 
1;




Re: Dice - Rix70 - 04.08.2016

ty man but it doesnt work is what command is it?
i added it to pawn complied it to amx file and put it into filter script renmed both to Dice and but in filter script and wrote that in server config too


Re: Dice - Shinja - 04.08.2016

you have zcmd and sscanf btw?


Re: Dice - Rix70 - 04.08.2016

the plugins ? i have scanff but add me on skype and help me linus.45 if u want to but if not u can help me from here but yes i have scanff but should i download zmdf?


Re: Dice - Shinja - 04.08.2016

https://sampforum.blast.hk/showthread.php?tid=570927
https://sampforum.blast.hk/showthread.php?tid=91354