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:
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 @ ".");
}
Basically, we assigned the client a Dice_game_wins variable and a Dice_game_loses variable. When they win, we add one to the wins variable, when they lose, we add one to the loses variable.
%client.<namehere> Variables are attached to the client, and can keep track of things over time that are specific to that person. An example is %client.name, which stores the client's name.(try adding messageclient(%client,'',%client.name @ ", you suck!"); at the end of the roll dice function for an example of using %client.name)
Another example that you will probably use a lot is %client.player, which is the clients player object(their blocko minifigure). For an example of using this, try
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"))
There are a lot of good player.<functionname>() functions that are fun to screw around with.
Try
player.setvelocity(X Y Z)(try "0 0 100")
player.kill() (what do you think?)
player.setshapename("name") (change the name that appears above your head, try "!!" @ %client.name @ "!!")
etc. etc.
Wow I really got off track there.
Anyways,
when they say /diceratio, we send them a message telling them their wins / losses.
Ideas for expansion:(you should try these)
+Make it also track %client.dice_game_count for how many times in total they have played, and make a /dicetotal to see that.
+Add a /cleardicerecord so they can clear their wins and loses.
+keep at it damnit