help me dice command
#5

Quote:
Originally Posted by jasperschellekens
View Post
Check at the code i posted. I literally fixed the error for you.
Your code would work already but you might want to add the things i marked red.

Code:
new RequestDiceBetting[MAX_PLAYERS];
 // on top of your script.

CMD:dicep(playerid, params[])
{
	new targetid, str[180], str2[180], bet;
	if(sscanf(params, "ui", targetid, bet)) return SCM(playerid, -1, "/dicep [playerid] [money]");
	if(targetid == INVALID_PLAYER_ID) return SCM(playerid, -1, "Player Isnt Connected.");
	new mymoney = (GetPlayerMoney(playerid));
	new targetmoney = (GetPlayerMoney(targetid));
	if(bet>mymoney) return SCM(playerid, -1, "You Dont Have That Amount Of Money.");
	if(bet>targetmoney) return SCM(playerid, -1, "He Dont Have Enough Money.");
	if(bet >= targetmoney)
	{
	    new pname[MAX_PLAYER_NAME], tname[MAX_PLAYER_NAME];
	    GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
	    GetPlayerName(targetid, tname, MAX_PLAYER_NAME);
		format(str, sizeof(str), "Dice Sent.");
		format(str2, sizeof(str2), "[%i] %s Sent You Dice with %i .", playerid, pname, bet);
		SCM(playerid, -1, str);
		SCM(targetid, -1, str2);
		ReqeustDiceBetting[playerid] = 1;
	}
	return 1;
}

CMD:acceptdice(playerid, params[])
{
	if(sscanf(params, "u", playerid)) return SCM(playerid, -1, "/acceptdice[id]");
	if(ReqeustDiceBetting[u] == 0) return SCM(playerid, -1, "Player did not send a dice request.");
	ReqeustDiceBetting[u] = 0;
 	if(!sscanf(params, "u", playerid))
	{
		new player1, player2;
		player1=random(7);
		player2=random(7);
	if(player1>player2)
	{
		new string[128];
		new string2[128];
		format(string, sizeof(string), "You win %i", bet);
		GivePlayerMoney(playerid, bet);
		GivePlayerMoney(targetid, -bet);
		format(string2, sizeof(string2), "You rolled %i %i", player1, player2);
		SCM(playerid,Green , string2);
		SCM(playerid,Green , string);

	}
	if(player1<player2)
	{
		new string[128];
		new string2[128];
		format(string, sizeof(string), "You lose %i", bet);
		GivePlayerMoney(targetid, bet);
		GivePlayerMoney(playerid, -bet);
		format(string2, sizeof(string2), "You rolled %i %i", player1, player2);
		SCM(playerid,0xCC0000 , string2);
		SCM(playerid,0xCC0000 , string);
	}
    return 1;
}
Thanks For Helping me but i have these errors .. :*
Code:
C:\Users\Kurdi's\Desktop\samp037_svr_R2-1-1_win32\gamemodes\FirstCode.pwn(712) : error 017: undefined symbol "ReqeustDiceBetting"
C:\Users\Kurdi's\Desktop\samp037_svr_R2-1-1_win32\gamemodes\FirstCode.pwn(712) : warning 215: expression has no effect
C:\Users\Kurdi's\Desktop\samp037_svr_R2-1-1_win32\gamemodes\FirstCode.pwn(712) : error 001: expected token: ";", but found "]"
C:\Users\Kurdi's\Desktop\samp037_svr_R2-1-1_win32\gamemodes\FirstCode.pwn(712) : error 029: invalid expression, assumed zero
C:\Users\Kurdi's\Desktop\samp037_svr_R2-1-1_win32\gamemodes\FirstCode.pwn(712) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply


Messages In This Thread
help me dice command - by Osamakurdi - 03.01.2018, 08:53
Re: help me dice command - by jasperschellekens - 03.01.2018, 08:58
Re: help me dice command - by Osamakurdi - 03.01.2018, 09:19
Re: help me dice command - by jasperschellekens - 03.01.2018, 09:45
Re: help me dice command - by Osamakurdi - 03.01.2018, 09:52
Re: help me dice command - by jasperschellekens - 03.01.2018, 09:53
Re: help me dice command - by Osamakurdi - 03.01.2018, 09:59
Re: help me dice command - by jasperschellekens - 03.01.2018, 10:03
Re: help me dice command - by Osamakurdi - 03.01.2018, 17:51

Forum Jump:


Users browsing this thread: 1 Guest(s)