Code:
new Global_variable
new Global_variable2
// This is where you would put global variables etc, at the top of the file after the #include
////////////////////////////////////////////////////////////////////
// Start Lottery
//////////////////////////////////////////////////////////////////
public cmd_startlotto(id,level,cid) {
if(!cmd_access(id,level,cid,2)) {
return PLUGIN_HANDLED;
}
// start lotto
new winningticket = random_num (0, 3)
new arg1[256];
new hudstring[256];
read_argv(1,arg1,255);
new jackpot = str_to_num(arg1)
format(hudstring,255,"%s",lotterymsg);
return PLUGIN_HANDLED;
}
////////////////////////////////////////////////////////////////////
// Buy Lotto Ticket
//////////////////////////////////////////////////////////////////
public buyticket(id) {
/*if(!cmd_access(id,level,cid,1)) {
return PLUGIN_HANDLED;
}*/
new ticket = random_num(0,3)
if(haveticket = 1) { // if exceeds our array
client_print(id,print_chat,"* [Lotto] You already have lotto ticket, gotta make it fair^n");
return PLUGIN_HANDLED;
}
client_print(id,print_chat,"* [Lotto] You bought a lotto ticket^n");
return PLUGIN_HANDLED;
}
////////////////////////////////////////////////////////////////////
// check Lotto Ticket
//////////////////////////////////////////////////////////////////
public checkticket(id) {
/*if(!cmd_access(id,level,cid,1)) {
return PLUGIN_HANDLED;
}*/
if(ticket != winningticket) { // if exceeds our array
client_print(id,print_chat,"* [Lotto] you did not win, try again next time!^n");
return PLUGIN_HANDLED;
}
client_print(id,print_chat,"* [Lotto] YOU WON THE LOTTERY!!! CONGRATS!!!^n");
userwallet[id] += jackpot
return PLUGIN_HANDLED;
}