PDA

View Full Version : Making a Donut System! [Urgent]


MeowZ
13/08/2014, 05:48 PM
Was just wondering if anyone could help making me a donut system, it would consist of a few commands... First of all....

/givedonuts [PlayerID] [Donut Amount] - This command would be used to give donuts to a player, with donuts, players could go to the Donut store behind All Saints to exchange them for prizes.

/exchange - Doing this would require you to be in the Donut store, with doing this, will bring up with a menu which consists of prizes that you can exchange your donuts for.

/takedonuts - Doing this, Admins could deduct donuts from a players account.

Prizes to win....

Basic Shotgun+ Mp5: 1 Donut
Deagle: 1 Donut
M4: 1 Donut
Spas12: 2 Donuts
Sniper: 3 Donuts
x2 Grenades: 5 Donuts
1 Free car! (Sends a message to admins saying "Player ID [id] bought a free car at the donut shop": 20 Donuts
500k Cash: 20 Donuts
Making a Business ( Also Sends a admin a message: 45 donuts
Making a house ( Also sends a admin a message): 50 Donuts
Jetpack: 75 Donuts

I would be very grateful, if you need to contact me, use this method...

Message me over here.
Skype: lukeb53

All credits will be given to you.

[XST]O_x
13/08/2014, 05:57 PM
https://www.******.co.il/?gws_rd=ssl#q=samp+cookie+system
So much results... Just alter the code and add codes like:

if(playerCookies[playerid >= 20]
GivePlayerCar or whatever

MeowZ
13/08/2014, 05:58 PM
Im a noob:D thats why i required help, but thanks, reckon you could help? +1 to that comment anywayz bud:D

MeowZ
15/08/2014, 09:24 PM
Anyone?

Norrin
16/08/2014, 07:02 AM
Set a variable known as donuts consisting of a player array.
new pDonuts[MAX_PLAYERS];

Then add this to OnPlayerConnect - pDontus[playerid] = 0.0;

For /givedonuts, let us assume the person who you want to give is stored in a variable "targetid" and "amount" contains the donut amounts.

It should be something like:
pDontus[targetid] += amount;

Then for /exchange, it should be:

if(pDonuts[playerid] >= 10) // add prize here
else if(pDonuts[playerid] >= 20) // add a better prize here
else SendClientMessage(playerid, -1, "You don't have enough donuts!");

Hope this help. :)

Affan
16/08/2014, 07:46 AM
enum donutsystem
{
donuts,
admin
}
new donutinfo[MAX_PLAYERS][donutsystem];

// Save & Load the donuts , I expect you know how to do it. I won't do it since I don't know what system you are using

CMD:givedonuts(playerid, params[])
{
new id, amount;
if(sscanf(params, "ui", id, amount)) return SendClientMessage(playerid, -1, "USAGE: /givedonuts [PlayerID] [Donut Amount]");
donutinfo[id][donuts] = donutinfo[id][donuts] + amount; // Getting the amount of donuts you have and adding the amount you gave
// Do the rest you want
return 1;
}

CMD:exchange(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, xxx, xxx, xxx)) // input your corindates of the shop
{
// Show the dialog
}
else return SendClientMessage(playerid, -1, "You are not inside the shop");
return 1;
}

CMD:takedonuts(playerid, params[])
{
if(donutinfo[playerid][admin] > 1)
{
new id, amount;
if(sscanf(params, "ui", id, amount)) return SendClientMessage(playerid, -1, "USAGE: /takedonuts [PlayerID] [Donut Amount]");
donutinfo[id][donuts] = donutinfo[id][donuts] - amount; // Getting the amount of donuts you have and subtracting the amount you specified
// Do the rest you want
}
return 1;
}

MeowZ
05/09/2014, 04:10 PM
enum donutsystem
{
donuts,
admin
}
new donutinfo[MAX_PLAYERS][donutsystem];

// Save & Load the donuts , I expect you know how to do it. I won't do it since I don't know what system you are using

CMD:givedonuts(playerid, params[])
{
new id, amount;
if(sscanf(params, "ui", id, amount)) return SendClientMessage(playerid, -1, "USAGE: /givedonuts [PlayerID] [Donut Amount]");
donutinfo[id][donuts] = donutinfo[id][donuts] + amount; // Getting the amount of donuts you have and adding the amount you gave
// Do the rest you want
return 1;
}

CMD:exchange(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, xxx, xxx, xxx)) // input your corindates of the shop
{
// Show the dialog
}
else return SendClientMessage(playerid, -1, "You are not inside the shop");
return 1;
}

CMD:takedonuts(playerid, params[])
{
if(donutinfo[playerid][admin] > 1)
{
new id, amount;
if(sscanf(params, "ui", id, amount)) return SendClientMessage(playerid, -1, "USAGE: /takedonuts [PlayerID] [Donut Amount]");
donutinfo[id][donuts] = donutinfo[id][donuts] - amount; // Getting the amount of donuts you have and subtracting the amount you specified
// Do the rest you want
}
return 1;
}


So what will i need to do?

and i use this admin system LuxAdmin :D (http://forum.sa-mp.com/showthread.php?t=120724)