- 0
Problema comanda
-
Similar Content
-
Recently Browsing 0 members
- No registered users viewing this page.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.
Question
Westerfer32
Problemă întâlnită (descriere):E o comanda dice e pe cmd si as vrea sa o schimb pentru un server mysql ...
Ero(area / rile) / warning-(ul / urile):Multe
Liniile de cod / sursa / script-ul:
[pawn]CMD:dice(playerid, params[]){
new bet;
if (sscanf(params, "i",bet))
{
SendClientMessage(playerid,MSGCMDS_COLOR, "Usage: "/Dice <amount to bet>"");
}
else
{
if (bet<1)
{
SendClientMessage(playerid,MSGFAIL_COLOR, "Are you kidding me? Bet a positive amount.");
}
else if (bet>1000000)
{
SendClientMessage(playerid,MSGFAIL_COLOR, "Erm.. To protect a player from losing all his Money, theres a Limit of $1,000,000");
}
else
{
new Cash=GetPlayerMoney(playerid);
if (Cash<bet)
{
new string[128];
format(string,sizeof(string),"No Money - No Bet. Your Cash: $%i",Cash);
SendClientMessage(playerid,MSGFAIL_COLOR,string);
}
else
{
new NumberDrawn11,NumberDrawn12,NumberDouble1,NumberDrawn21,NumberDrawn22,NumberDouble2,Winner;
NumberDrawn11=random(6)+1;
NumberDrawn12=random(6)+1;
if (NumberDrawn11==NumberDrawn12) NumberDouble1=NumberDrawn11;
NumberDrawn21=random(6)+1;
NumberDrawn22=random(6)+1;
if (NumberDrawn21==NumberDrawn22) NumberDouble2=NumberDrawn21;
if (NumberDrawn11+NumberDrawn12>NumberDrawn21+NumberDrawn22)
{
Winner=1;
}
else if (NumberDrawn11+NumberDrawn12<NumberDrawn21+NumberDrawn22)
{
Winner=2;
}
else
{
if (NumberDouble1>NumberDouble2) Winner=1;
else if (NumberDouble1<NumberDouble2) Winner=2;
}
new string[64];
format(string,sizeof(string),"Numbers Diced 1: %d %d",NumberDrawn11,NumberDrawn12);
SendClientMessage(playerid,MSGINFO_COLOR,string);
format(string,sizeof(string),"Numbers Diced 2: %d %d",NumberDrawn21,NumberDrawn22);
SendClientMessage(playerid,MSGINFO_COLOR,string);
if (Winner==1)
{
if (NumberDouble1>0)
{
format(string,sizeof(string),"You won $%d, a double!",bet*2);
SendClientMessage(playerid,MSGSUCC_COLOR,string);
SetPVarInt(playerid,"Money",GetPVarInt(playerid,"Money")+bet*2);
GivePlayerMoney(playerid,bet*2);
}
else
{
format(string,sizeof(string),"You won $%d",bet);
SendClientMessage(playerid,MSGSUCC_COLOR,string);
SetPVarInt(playerid,"Money",GetPVarInt(playerid,"Money")+bet);
GivePlayerMoney(playerid,bet);
}
}
else if (Winner==2)
{
format(string,sizeof(string),"You lost $%d",bet);
SendClientMessage(playerid,MSGFAIL_COLOR,string);
SetPVarInt(playerid,"Money",GetPVarInt(playerid,"Money")-bet);
GivePlayerMoney(playerid,-bet);
}
else if (Winner==0)
{
format(string,sizeof(string),"Draw",bet);
SendClientMessage(playerid,MSGFAIL_COLOR,string);
}
}
}
}
return 1;
}[/pawn]
Imagini / Video (optional):nu
Aţi încercat să rezolvaţi singur?:De 1 zi incerc
Rog un scripter bun daca doreste sa ma ajute
7 answers to this question
Recommended Posts