SA-MP Forums Archive
Help me to make a command to work mor business - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help me to make a command to work mor business (/showthread.php?tid=554180)



Help me to make a command to work mor business - Camataru77 - 02.01.2015

if(strcmp(cmd, "/buy", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (!PlayerToPoint(100, playerid,-30.875, -88.9609, 1004.53))//centerpoint 24-7
{
SendClientMessage(playerid, COLOR_GRAD2, "[Eroare]: You are not in a 24-7 !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE{FFFFFF}: /buy [item number]");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "|_______ 24-7 _______|");
SendClientMessage(playerid, COLOR_WHITE, "| 1: Cell Phone {00FF00}$500{FFFFFF} 2: Loz in plic {00FF00}$700");
SendClientMessage(playerid, COLOR_WHITE, "| 3: Phone Book {00FF00}$100{FFFFFF} 4: Dice {00FF00}$100");
SendClientMessage(playerid, COLOR_WHITE, "| 5: Break Kit {00FF00}$25.000{FFFFFF} 6: Condom {00FF00}$100");
SendClientMessage(playerid, COLOR_WHITE, "| 7: CD-Player {00FF00}$5.000{FFFFFF} 8: Camera {00FF00}$2500");
SendClientMessage(playerid, COLOR_WHITE, "| 9: Phone Credit {00FF00}$3.500{FFFFFF} 10: Watch {00FF00}$100");
SendClientMessage(playerid, COLOR_WHITE, "| 11: Fish. tools {00FF00}$1500{FFFFFF} 12: Rope {00FF00}$200");
SendClientMessage(playerid, COLOR_WHITE, "| 13: Cigarettes {00FF00}$3.000{FFFFFF} 14: Escape Kit {00FF00}$25.000");
return 1;
}
new item = strval(tmp);
if(SBizzInfo[9][sbProducts] == 0)
{
GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
return 1;
}
if (item == 1 && GetPlayerMoney(playerid) > 499)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 150 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 15000 - price;
format(string, sizeof(string), "~r~-%s", DecimalPoint(payout));
GameTextForPlayer(playerid, string, 5000, 1);
GivePlayerMoney(playerid,- payout);
SBizzInfo[9][sbTill] += payout;
ExtortionSBiz(9, payout/2);
}
else
{
format(string, sizeof(string), "~r~-%s", DecimalPoint(500));
GameTextForPlayer(playerid, string, 5000, 1);
GivePlayerMoney(playerid,-500);
SBizzInfo[9][sbTill] += 500;
ExtortionSBiz(9, 250);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
new randphone = 1000 + random(8999);//minimum 1000 max 9999
PlayerInfo[playerid][pPnumber] = randphone;
format(string, sizeof(string), "Mobile Phone Purchased your new Number is %d", randphone);
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_GRAD5, "You can check this anytime by Typing /stats");
SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE{FFFFFF}: You can now type /help to see your cell phone commands.");
return 1;
}
else if (item == 2 && GetPlayerMoney(playerid) > 699)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 500 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 700 - price;
GivePlayerMoney(playerid,- payout);
SBizzInfo[9][sbTill] += payout;
ExtortionSBiz(9, payout/2);
format(string, sizeof(string), "~r~-%s", DecimalPoint(payout));
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
GivePlayerMoney(playerid,-700);
SBizzInfo[9][sbTill] += 700;
ExtortionSBiz(9, 350);
format(string, sizeof(string), "~r~-%s", DecimalPoint(700));
GameTextForPlayer(playerid, string, 5000, 1);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
new prize;
new symb1[32]; new symb2[32]; new symb3[32];
new randcard1 = random(10);//minimum 1000 max 9999
new randcard2 = random(10);//minimum 1000 max 9999
new randcard3 = random(10);//minimum 1000 max 9999
if(randcard1 >= 5)
{
format(symb1, sizeof(symb1), "~b~]");
randcard1 = 1;
}
else if(randcard1 <= 4 && randcard1 >= 2)
{
format(symb1, sizeof(symb1), "~g~]");
randcard1 = 2;
}
else if(randcard1 < 2)
{
format(symb1, sizeof(symb1), "~y~]");
randcard1 = 3;
}
if(randcard2 >= 5)
{
format(symb2, sizeof(symb2), "~b~]");
randcard2 = 1;
}
else if(randcard2 <= 4 && randcard2 >= 2)
{
format(symb2, sizeof(symb2), "~g~]");
randcard2 = 2;
}
else if(randcard2 < 2)
{
format(symb2, sizeof(symb2), "~y~]");
randcard2 = 3;
}
if(randcard3 >= 5)
{
format(symb3, sizeof(symb3), "~b~]");
randcard3 = 1;
}
else if(randcard3 <= 4 && randcard3 >= 2)
{
format(symb3, sizeof(symb3), "~g~]");
randcard3 = 2;
}
else if(randcard3 < 2)
{
format(symb3, sizeof(symb3), "~y~]");
randcard3 = 3;
}
if(randcard1 == randcard2 && randcard1 == randcard3)
{
if(randcard1 > 5)
{
prize = 2500;
}
if(randcard1 <= 4 && randcard1 >= 2)
{
prize = 1500;
}
if(randcard1 < 2)
{
prize = 500;
}
GivePlayerMoney(playerid,prize);
SBizzInfo[9][sbTill] -= prize;
ExtortionSBiz(9, prize);
format(string, sizeof(string), "%s %s %s ~n~~n~~w~~g~%s",symb1,symb2,symb3, DecimalPoint(prize));
}
else
{
format(string, sizeof(string), "%s %s %s ~n~~n~~w~~r~$0",symb1,symb2,symb3);
}
GameTextForPlayer(playerid, string, 3000, 3);
return 1;
}
else if (item == 3 && GetPlayerMoney(playerid) > 99)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 10 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 100 - price;
GivePlayerMoney(playerid,- payout);
SBizzInfo[9][sbTill] += payout;
ExtortionSBiz(9, payout);
GameTextForPlayer(playerid, "~r~-$10", 5000, 1);
}
else
{
GivePlayerMoney(playerid,- 100);
SBizzInfo[9][sbTill] += 100;
ExtortionSBiz(9, 50);
format(string, sizeof(string), "~r~-%s", DecimalPoint(100));
GameTextForPlayer(playerid, string, 5000, 1);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
PlayerInfo[playerid][pPhoneBook] = 1;
format(string, sizeof(string), "Phone Book Purchased you can look up any Players Number !");
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE{FFFFFF}: Type /number <id/name>.");
return 1;
}
else if (item == 4 && GetPlayerMoney(playerid) > 99)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 10 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 100 - price;
GivePlayerMoney(playerid,- payout);
SBizzInfo[9][sbTill] += payout;
ExtortionSBiz(9, payout/2);
format(string, sizeof(string), "~r~-%s", DecimalPoint(payout));
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
GivePlayerMoney(playerid,-100);
SBizzInfo[9][sbTill] += 100;
ExtortionSBiz(9, 50);
format(string, sizeof(string), "~r~-%s", DecimalPoint(100));
GameTextForPlayer(playerid, string, 5000, 1);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
gDice[playerid] = 1;
format(string, sizeof(string), "Dice Purchased you can throw your Dice.");
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE{FFFFFF}: Type /dice ");
return 1;
}
else if (item == 5 && GetPlayerMoney(playerid) > 24999)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 10 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 25000 - price;
GivePlayerMoney(playerid, - payout);
format(string, sizeof(string), "~r~-%s", DecimalPoint(payout));
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
SBizzInfo[9][sbTill] += 25000;
ExtortionSBiz(9, 17500);
GivePlayerMoney(playerid, - 25000);
format(string, sizeof(string), "~r~-%s", DecimalPoint(25000));
GameTextForPlayer(playerid, string, 5000, 1);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Break Kit purchased.");
BreakKit[playerid] = 1;
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE{FFFFFF}: Acum poti folosi /break pentru a sparge o masina !");
SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE{FFFFFF}: Foloseste /dl pentru a vedea id-ul masinii !");
return 1;
}
else if (item == 6 && GetPlayerMoney(playerid) > 99)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 1 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 100 - price;
GivePlayerMoney(playerid,- payout);
format(string, sizeof(string), "~r~-%s", DecimalPoint(payout));
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
SBizzInfo[9][sbTill] += 100;
ExtortionSBiz(9, 50);
GivePlayerMoney(playerid,-100);
format(string, sizeof(string), "~r~-%s", DecimalPoint(100));
GameTextForPlayer(playerid, string, 5000, 1);
}
Condom[playerid] ++;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Condom Purchased.");
SendClientMessage(playerid, COLOR_GRAD4, string);
return 1;
}
else if (item == 7 && GetPlayerMoney(playerid) > 4999)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 10 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 5000 - price;
GivePlayerMoney(playerid, - payout);
format(string, sizeof(string), "~r~-%s", DecimalPoint(payout));
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
SBizzInfo[9][sbTill] += 5000;
ExtortionSBiz(9, 2500);
GivePlayerMoney(playerid, - 5000);
format(string, sizeof(string), "~r~-%s", DecimalPoint(5000));
GameTextForPlayer(playerid, string, 5000, 1);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "CD-Player Purchased.");
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE{FFFFFF}: Type /music");
return 1;
}
else if (item == 8 && GetPlayerMoney(playerid) > 2499)
{
SBizzInfo[9][sbTill] += 2500;
ExtortionSBiz(9, 1250);
GivePlayerMoney(playerid, - 2500);
format(string, sizeof(string), "~r~-%s", DecimalPoint(2500));
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Camera Purchased.");
SendClientMessage(playerid, COLOR_GRAD4, string);
GivePlayerWeapon(playerid, 43, 20);
return 1;
}
else if (item == 9 && GetPlayerMoney(playerid) > 3499)
{
if(PlayerInfo[playerid][pEuroCent] > 0)
{
SendClientMessage(playerid, COLOR_GREY, "[Eroare]: Ai deja telefonul incarcat !");
return 1;
}
SBizzInfo[9][sbTill] += 3500;
ExtortionSBiz(9, 1750);
GivePlayerMoney(playerid, - 3500);
SBizzInfo[2][sbTill] += 3500;
ExtortionSBiz(2, 1750);
PlayerInfo[playerid][pEuroCent] = 150;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~r~-%s", DecimalPoint(15000));
GameTextForPlayer(playerid, string, 5000, 1);
SendClientMessage(playerid, COLOR_GRAD4, "** Felicitari ! Tiai reincarcat telefonul cu 150 EuroCent.");
SendClientMessage(playerid, COLOR_WHITE, "INFO: Poti folosi acum /call & /sms !");
return 1;
}
else if (item == 10 && GetPlayerMoney(playerid) > 99)
{
if(PlayerInfo[playerid][pWatch] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "[Eroare]: You already have one");
return 1;
}
SBizzInfo[9][sbTill] += 100;
ExtortionSBiz(9, 50);
GivePlayerMoney(playerid, - 100);
format(string, sizeof(string), "~r~-%s", DecimalPoint(100));
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Watch Purchased.");
SendClientMessage(playerid, COLOR_WHITE, "GUIDE: /time");
SendClientMessage(playerid, COLOR_GRAD4, string);
PlayerInfo[playerid][pWatch] = 1;
return 1;
}
else if (item == 11 && GetPlayerMoney(playerid) > 1499)
{
if(PlayerInfo[playerid][pFishTool] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "[Eroare]: You already have one !");
return 1;
}
SBizzInfo[9][sbTill] += 1500;
ExtortionSBiz(9, 750);
GivePlayerMoney(playerid, - 1500);
format(string, sizeof(string), "~r~-%s", DecimalPoint(1500));
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "Fishing toolbox Purchased.");
PlayerInfo[playerid][pFishTool] = 1;
return 1;
}
else if (item == 12 && GetPlayerMoney(playerid) > 199)
{
if(Rope[playerid] >= 5)
{
SendClientMessage(playerid, COLOR_GREY, "[Eroare]: You have 5 already !");
return 1;
}
SBizzInfo[9][sbTill] += 200;
ExtortionSBiz(9, 100);
GivePlayerMoney(playerid, - 200);
format(string, sizeof(string), "~r~-%s", DecimalPoint(200));
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "Rope Purchased.");
SendClientMessage(playerid, COLOR_GRAD4, "{00A1FF}USAGE{FFFFFF}: You can /tie now.");
Rope[playerid]++;
return 1;
}
else if (item == 13 && GetPlayerMoney(playerid) > 2999)
{
if(PlayerInfo[playerid][pCigarettes] != 0)
{
format(string, sizeof(string), "[Eroare]: You already have %d cigarettes left .", PlayerInfo[playerid][pCigarettes]);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
SBizzInfo[9][sbTill] += 3000;
ExtortionSBiz(9, 1500);
GivePlayerMoney(playerid, - 3000);
PlayerInfo[playerid][pCigarettes] = 20;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~r~-%s", DecimalPoint(3000));
GameTextForPlayer(playerid, string, 5000, 1);
SendClientMessage(playerid, COLOR_GRAD4, "Cigarettes Purchased.");
SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE{FFFFFF}: You can /smokeciggar now !");
return 1;
}
else if (item == 14 && GetPlayerMoney(playerid) > 24999)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 10 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 25000 - price;
GivePlayerMoney(playerid, - payout);
format(string, sizeof(string), "~r~-%s", DecimalPoint(payout));
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
SBizzInfo[9][sbTill] += 25000;
ExtortionSBiz(9, 12500);
GivePlayerMoney(playerid, - 25000);
format(string, sizeof(string), "~r~-%s", DecimalPoint(25000));
GameTextForPlayer(playerid, string, 5000, 1);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Tool Kit purchased.");
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE{FFFFFF}: Acum poti folosi /escape pentru a evada din Jail !");
ToolKit[playerid] = 1;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "[Eroare]: You don't have the cash for that !");
return 1;
}
}
return 1;
}





I want to money for this thing to go in a 24/7 busines where is buy a thing ?