3616
Modification Help / Re: Adding ratio to dice game script
« on: August 06, 2008, 02:13:15 AM »
What was the error? its kind of important, you know...
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
So it works and everthing, but i want it to do 1 more thing. Make it so it shows the ratio you won over what you lost. Example: Lets say i won 4 times and lost 6, Iwant to type /ratio and it will say 4/6. Not asking for you to just give it to me. Just a breif explination on how to. Well anyway here is the script thus far:Code: [Select]function servercmdrolldice(%client)
{
%diceroll = getRandom(1,6);
if(%diceroll >= 3)
{
messageclient(%Client,""," Sweet I rolled a "@%diceroll@" and won!");
%client.Dice_game_wins+=1;//add 1 to their win count
}
else
{
messageclient(%Client,""," stuff I rolled a "@%diceroll@" and lost!");
%client.Dice_game_loses+=1;//add 1 to their lose score
}
}
function servercmddiceratio(%client){
if(!%client.Dice_game_wins){%client.Dice_game_wins=0;}//if they have no wins, set it to 0 so it doesnt say /3 or something
if(!%client.Dice_game_loses){%client.Dice_game_loses=0;}//if they have no loses, set it to 0 so it doesnt say 3/ or something
messageclient(%client,'',"Your dice game ratio is" SPC %client.Dice_game_wins @ "/" @ %client.Dice_game_loses @ ".");
}
function servercmdLocate_Me(%client){
bottomprint(%client,%client.player.getposition(),2);//show them their position
}
That'll show the client their player's position using the function getposition( player.getposition(), outputs the playerobjects X Y Z(i.e "3.4 84 102"))