Jump to content
  • 0

Problema comanda /accept [item]


Haman22

Question

Salut am si eu o problema cu comanda /accept.

Deci: daca sunt cop si ofer ticket cuiva playerul trebuie sa de-a "/accept ticket ID" odata ce da ii apare you have paid the ticket dar nu primesc bani pe ticket nici de la el nu se ia. si la raport nu se pune nici un punct chiar daca este setat.. la fel este si la refill etc

Dupa ce scrie You have paid the ticket mai jos apare Error: Unknown command 

/accept cu toate https://pastebin.com/1794hb45

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

CMD:accept(playerid, params[]) {

 new item[64], id;

 if(sscanf(params, "s[64]u", item, id)) {

  SCM(playerid, -1, "Syntax: {FFFFFF}/accept [item] [id]");

  SCM(playerid, -1, "Items: normalvoucher, premiumvoucher, invite, gun, car, ticket, dice, cinvite, materials, refill, live, repair, drugs, hidden, tradecar.");

  return true;

 }

 if(strcmp(item, "normalvoucher", true) == 0) {

  if(NormalOffer[playerid] >= 999) return SCM(playerid, -1, "Nu ti-a oferit nimeni un voucher.");

  if(PlayerInfo[id][pNormalVoucher] < 1) return SCM(playerid, -1, "Acel player nu are un voucher.");

  if(NormalOffer[playerid] != id) return SCM(playerid, -1, "This player has not offered you a normal voucher.");

  if(GetPlayerCash(playerid) < NormalPrice[playerid]) return SCM(playerid, -1, "Nu ai bani.");

  SCMf(playerid, COLOR_DCHAT, "TRADE >> {ffffff}You bought a normal voucher for $%s from %s.", FormatNumber(NormalPrice[playerid]), GetName(NormalOffer[playerid]));

  SCMf(NormalOffer[playerid], COLOR_DCHAT, "TRADE >> {ffffff}%s has bought your normal voucher for $%s.", GetName(playerid), FormatNumber(NormalPrice[playerid]));

  GivePlayerCash(NormalOffer[playerid], NormalPrice[playerid]);

  GivePlayerCash(playerid, -NormalPrice[playerid]);

     new log[128];

     PlayerInfo[NormalOffer[playerid]][pNormalVoucher] --;

     PlayerInfo[playerid][pNormalVoucher] ++;

     format(log, 128, "%s bought normal voucher with $%s from %s", GetName(playerid), FormatNumber(NormalPrice[playerid]), GetName(NormalPrice[playerid]));

  insert_trade_logs(PlayerInfo[playerid][pSQLID], PlayerInfo[NormalOffer[playerid]][pSQLID], GetName(playerid), GetName(NormalOffer[playerid]), log);

  pUpdateInt(playerid, "NormalVoucher", PlayerInfo[playerid][pNormalVoucher]);

  pUpdateInt(NormalOffer[playerid], "NormalVoucher", PlayerInfo[NormalOffer[playerid]][pNormalVoucher]);

  NormalOffer[playerid] = 999;

  NormalPrice[playerid] = 0;

  NormalOffer[id] = 999;

  NormalPrice[id] = 0;

 }

 else if(strcmp(item, "premiumvoucher", true) == 0) {

  if(PremiumOffer[playerid] >= 999) return SCM(playerid, -1, "Nu ti-a oferit nimeni un voucher.");

  if(PlayerInfo[id][pPremiumVoucher] < 1) return SCM(playerid, -1, "Acel player nu are un voucher.");

  if(PremiumOffer[playerid] != id) return SCM(playerid, -1, "This player has not offered you a premium voucher.");

  if(GetPlayerCash(playerid) < PremiumPrice[playerid]) return SCM(playerid, -1, "Nu ai bani.");

  SCMf(playerid, COLOR_DCHAT, "TRADE >> {ffffff}You bought a premium voucher for $%s from %s.", FormatNumber(PremiumPrice[playerid]), GetName(PremiumOffer[playerid]));

  SCMf(PremiumOffer[playerid], COLOR_DCHAT, "TRADE >> {ffffff}%s has bought your premium voucher for $%s.", GetName(playerid), FormatNumber(PremiumPrice[playerid]));

     new log[128];

     PlayerInfo[PremiumOffer[playerid]][pPremiumVoucher] --;

     PlayerInfo[playerid][pPremiumVoucher] ++;

     format(log, 128, "%s bought premium voucher with $%s from %s", GetName(playerid), FormatNumber(NormalPrice[playerid]), GetName(PremiumPrice[playerid]));

  insert_trade_logs(PlayerInfo[playerid][pSQLID], PlayerInfo[PremiumOffer[playerid]][pSQLID], GetName(playerid), GetName(PremiumOffer[playerid]), log);

  GivePlayerCash(PremiumOffer[playerid], PremiumPrice[playerid]);

  GivePlayerCash(playerid, -PremiumPrice[playerid]);

  pUpdateInt(playerid, "PremiumVoucher", PlayerInfo[playerid][pPremiumVoucher]);

  pUpdateInt(PremiumOffer[playerid], "PremiumVoucher", PlayerInfo[PremiumOffer[playerid]][pPremiumVoucher]);

  PremiumOffer[playerid] = 999;

  PremiumPrice[playerid] = 0;

  PremiumOffer[id] = 999;

  PremiumPrice[id] = 0;

 }

 if(id == INVALID_PLAYER_ID) return SCM(playerid, -1, "Invalid id.");

 if(strcmp(item, "invite", true) == 0) {

  if(PlayerInfo[playerid][pMember] >= 1) return SCM(playerid, -1, "Deja te afli intr-o factiune.");

  if(PlayerInfo[FactionOffer[playerid]][pMember] < 1) return SCM(playerid, -1, "Playerul ce ti-a dat invite nu este intr-o factiune.");

  if(FactionOffer[playerid] == 999) return SCM(playerid, -1, "Nu ai primit o invitatie.");

  switch(PlayerInfo[FactionOffer[playerid]][pMember]) {

   case 1: PlayerInfo[playerid][pTeam] = 2;

   case 2: PlayerInfo[playerid][pTeam] = 2;

   case 3: PlayerInfo[playerid][pTeam] = 2;

   case 4: PlayerInfo[playerid][pTeam] = 5;

   case 5: PlayerInfo[playerid][pTeam] = 5;

   case 6: PlayerInfo[playerid][pTeam] = 5;

   case 8: PlayerInfo[playerid][pTeam] = 2;

   case 9: PlayerInfo[playerid][pTeam] = 4;

   case 10: PlayerInfo[playerid][pTeam] = 5;

   case 11: PlayerInfo[playerid][pTeam] = 11;

   case 13: PlayerInfo[playerid][pTeam] = 4;

   case 14: PlayerInfo[playerid][pTeam] = 4;

   case 15: PlayerInfo[playerid][pTeam] = 4;

  }

  PlayerInfo[playerid][pMember] = PlayerInfo[FactionOffer[playerid]][pMember]; PlayerInfo[playerid][pRank] = 1;

  PlayerInfo[playerid][pFactionJoin] = gettime();

  SetPlayerVirtualWorld(playerid, 0); SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pModel],1154.2300,-1770.9606,16.5992, 1.0, -1, -1, -1, -1, -1, -1);

  gTeam[playerid] = PlayerInfo[playerid][pTeam];

  SetPlayerToTeamColor(playerid); SpawnPlayer(playerid);

  gString[0] = (EOS);

  SCMf(playerid, COLOR_LIGHTBLUE, "You are now a member of the %s.", NumeFactiune(PlayerInfo[playerid][pMember]));

  SendFamilyMessage(PlayerInfo[playerid][pMember], COLOR_CLIENT, "%s has joined the group (invited by %s).", GetName(playerid), GetName(FactionOffer[playerid]));

  mysql_format(SQL, gString, 256, "UPDATE `users` SET `Team` = '%d', `Member` = '%d', `Rank` = '1', `FactionJoin` = '%d' WHERE `id` = '%d' LIMIT 1", PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pMember], PlayerInfo[playerid][pFactionJoin], PlayerInfo[playerid][pSQLID]);

  mysql_tquery(SQL, gString, "", "");

  mysql_format(SQL, gString, 300, "INSERT INTO faction_logs (`text`, `player`,`leader`) VALUES ('%s has joined the group %s (invited by %s).','%d','%d')", PlayerInfo[playerid][pNormalName], NumeFactiune(PlayerInfo[playerid][pMember]), PlayerInfo[FactionOffer[playerid]][pNormalName], PlayerInfo[playerid][pSQLID], PlayerInfo[FactionOffer[playerid]][pSQLID]);

  mysql_tquery(SQL, gString, "", "");

  save_raport(playerid, 1); save_raport(playerid, 2); save_raport(playerid, 3); save_raport(playerid, 4);

  save_raport(playerid, 5); save_raport(playerid, 6); save_raport(playerid, 7);

  mysql_format(SQL, gString, 256, "UPDATE `users` SET `PaydayON` = '0', `FactionTime` = '0' WHERE `id` = '%d' LIMIT 1", PlayerInfo[playerid][pSQLID]);

  mysql_tquery(SQL, gString, "", "");

  if(IsACop(playerid)) Iter_Add(Cops, playerid);

 }

 else if(strcmp(item, "cinvite", true) == 0) {

  if(GetPVarInt(playerid, "cinvitePlayer") == INVALID_PLAYER_ID) return SCM(playerid, -1, "Acest jucator nu este conectat.");

  if(id != GetPVarInt(playerid, "cinvitePlayer")) return SCM(playerid, -1, "Nu acest jucator ti-a oferit o invitatie in clan.");

  new year, month, day, hour, minute, second; gettime(hour, minute, second); getdate(year, month, day); gString[0] = (EOS);

  format(gString, sizeof gString, "%02d-%02d-%d %02d:%02d:%02d", day, month, year, hour, minute, second); pUpdateStr(playerid, "ClanJoin", gString);

  PlayerInfo[playerid][pClan] = PlayerInfo[id][pClan]; pUpdateInt(playerid, "Clan", PlayerInfo[playerid][pClan]);

  PlayerInfo[playerid][pCRank] = 1; pUpdateInt(playerid, "CRank", 1);

  inviteToClan(playerid, id, PlayerInfo[playerid][pClan]);

      mysql_format(SQL, gString, 300, "INSERT INTO `playerlogs` (`playerid` , `giverid` , `action`) VALUES ('%d', '0', '%s accepted invitation in clan id %d')", PlayerInfo[playerid][pSQLID], GetName(playerid), PlayerInfo[playerid][pClan]);

     mysql_tquery(SQL, gString, "", "");

        mysql_format(SQL, gString, 300, "INSERT INTO `clan_logs` (`clanid`, `text`) VALUES ('%d', '%s a intrat in clan.')", PlayerInfo[playerid][pClan], GetName(playerid));

     mysql_tquery(SQL, gString, "", "");

 }

 else if(strcmp(item, "materials", true) == 0) {

  if(MatsOffer[playerid] < 0) return 1;

  if(PlayerInfo[playerid][pConnectTime] < 5) return SCM(playerid, -1, "Ai nevoie de minim 5 ore pentru a folosi aceasta comanda.");

  if(MatsOffer[playerid] != id) return SCM(playerid, -1, "This player has not offered you materials.");

  if(GetPlayerCash(playerid) < MatsPrice[playerid]) return SCM(playerid, -1, "You don't have enough money.");

  PlayerInfo[playerid][pMats] += MatsAmmo[playerid]; PlayerInfo[MatsOffer[playerid]][pMats] -= MatsAmmo[playerid];

  GivePlayerCash(playerid, -MatsPrice[playerid]); GivePlayerCash(MatsOffer[playerid], MatsPrice[playerid]);

  SCMf(playerid, COLOR_DCHAT, "TRADE >> {ffffff}You buy %d materials for $%s from %s.", MatsAmmo[playerid], FormatNumber(MatsPrice[playerid]), GetName(MatsOffer[playerid]));

  SCMf(MatsOffer[playerid], COLOR_DCHAT, "TRADE >> {ffffff}%s bought your materials for $%s.", GetName(playerid), FormatNumber(MatsPrice[playerid]));

  pUpdateInt(playerid, "Materials", PlayerInfo[playerid][pMats]); pUpdateInt(MatsOffer[playerid], "Materials", PlayerInfo[MatsOffer[playerid]][pMats]);

  gString[0] = (EOS);

      mysql_format(SQL, gString, 300, "INSERT INTO `playerlogs` (`playerid` , `giverid` , `action`) VALUES ('%d', '%d', '%s sold mats %d to %s for $%s')", PlayerInfo[playerid][pSQLID], PlayerInfo[MatsOffer[playerid]][pSQLID], GetName(MatsOffer[playerid]), MatsAmmo[playerid], GetName(playerid), FormatNumber(MatsPrice[playerid]));

     mysql_tquery(SQL, gString, "", "");

     MatsOffer[playerid] = -1; MatsAmmo[playerid] = 0; MatsPrice[playerid] = 0;

 }

 

 else if(strcmp(item, "gun", true) == 0) {

  if(SellgunOffer[playerid] < 0) return 1;

  if(SellgunOffer[playerid] != id) return SCM(playerid, -1, "This player has not offered you gun.");

  if(GetPlayerCash(playerid) < SellgunPrice[playerid]) return SCM(playerid, -1, "You don't have enough money.");

  new weaponid, ammo, price, mats, idoffer;

  weaponid = SellgunID[playerid]; ammo = SellgunAmmo[playerid]; price = SellgunPrice[playerid]; mats = SellgunMats[playerid]; idoffer = SellgunOffer[playerid];

  GivePlayerWeaponEx(playerid, weaponid, ammo);

  PlayerInfo[idoffer][pMats] -= mats; pUpdateInt(idoffer, "Materials", PlayerInfo[idoffer][pMats]);

  GivePlayerCash(playerid, -price); GivePlayerCash(idoffer, price);

  SCMf(idoffer, COLOR_DCHAT, "TRADE >> {ffffff}You have given %s, weapon with %d ammo, for %d materials.", GetName(playerid), ammo, mats);

  SCMf(playerid, COLOR_DCHAT, "TRADE >> {ffffff}You have recieved a weapon with %d ammo from %s.", ammo, GetName(idoffer));

  gString[0] = (EOS);

      mysql_format(SQL, gString, 300, "INSERT INTO `playerlogs` (`playerid` , `giverid` , `action`) VALUES ('%d', '%d', '%s sold gun %d to %s for $%s')", PlayerInfo[playerid][pSQLID], PlayerInfo[SellgunOffer[playerid]][pSQLID], GetName(SellgunOffer[playerid]), SellgunID[playerid], GetName(playerid), FormatNumber(SellgunPrice[playerid]));

     mysql_tquery(SQL, gString, "", "");

     SellgunOffer[playerid] = -1; SellgunPrice[playerid] = 0; SellgunMats[playerid] = 0; SellgunAmmo[playerid] = 0; SellgunID[playerid] = 0;

 }

 else if(strcmp(item, "ticket", true) == 0) {

    if(TicketOffer[playerid] < 0) return 1;

    if(TicketOffer[playerid] != id) return SCM(playerid, -1, "This player has not offered you ticket.");

    if(!IsPlayerConnected(TicketOffer[playerid])) return SCM(playerid, -1, "Acel player nu este conectat.");

    if(GetPlayerCash(playerid) < TicketMoney[playerid]) return SCM(playerid, -1, "You don't have enough money.");

    SCM(playerid, -1, "You have paid the ticket.");

    SCMf(TicketOffer[playerid], -1, "%s has accepted the ticket you issued them.", GetName(playerid));

    save_raport(TicketOffer[id], 4);

    save_raport(playerid, 4);

    GivePlayerCash(playerid, -TicketMoney[playerid]);

    GivePlayerCash(TicketOffer[playerid], TicketMoney[playerid]);

    TicketOffer[playerid] = 999;

    TicketMoney[playerid] = 0;

    gString[0] = (EOS);

    mysql_format(SQL, gString, 300, "INSERT INTO `playerlogs` (`playerid` , `giverid` , `action`) VALUES ('%d', '%d', '%s ticketed %s for $%s')", PlayerInfo[playerid][pSQLID], PlayerInfo[TicketOffer[playerid]][pSQLID], GetName(TicketOffer[playerid]), GetName(playerid), FormatNumber(TicketMoney[playerid]));

    mysql_tquery(SQL, gString, "", "");

 }

 else if(strcmp(item, "refill", true) == 0) {

  if(RefillOffer[playerid] >= 999) return 1;

  if(RefillOffer[playerid] != id) return SCM(playerid, -1, "This player has not offered you a refill.");

  if(!IsPlayerConnected(RefillOffer[playerid])) return SCM(playerid, -1, "Acel player nu este conectat.");

  if(GetPlayerCash(playerid) < RefillPrice[playerid]) return SCM(playerid, -1, "Nu ai bani.");

  new car = gLastCar[playerid];

  SCMf(playerid, -1, "You refilled your car for $%d by Car Mecanic %s.", RefillPrice[playerid], GetName(RefillOffer[playerid]));

  SCMf(RefillOffer[playerid], -1, "You refilled %s's car and you received $%d.", GetName(playerid), RefillPrice[playerid]);

  GivePlayerCash(RefillOffer[playerid], RefillPrice[playerid]); GivePlayerCash(playerid, -RefillPrice[playerid]);

  if(Gas[car] < 110) { Gas[car] = 100; }

  RefillOffer[playerid] = 999; RefillPrice[playerid] = 0;

  gString[0] = (EOS);

     mysql_format(SQL, gString, 300, "INSERT INTO `playerlogs` (`playerid` , `giverid` , `action`) VALUES ('%d', '%d', '%s refill vehicle %s for $%s')", PlayerInfo[playerid][pSQLID], PlayerInfo[RefillOffer[playerid]][pSQLID], GetName(RefillOffer[playerid]), GetName(playerid), FormatNumber(RefillPrice[playerid]));

     mysql_tquery(SQL, gString, "", "");

     save_raport(RefillOffer[id], 1);

 }

 else if(strcmp(item, "live", true) == 0) {

  if(LiveOffer[playerid] != id) return SCM(playerid, -1, "This player has not offered you live.");

  if(!IsPlayerConnected(LiveOffer[playerid])) return SCM(playerid, -1, "Acel player nu este conectat.");

 

  SendClientMessage(playerid, COLOR_DCHAT, "LIVE >> {ffffff}You are now in a live interview! Respect the rules or you will get kicked!");

  SendClientMessage(playerid, COLOR_DCHAT, "LIVE >> {ffffff}Everything you say will be seen by everyone on the server!");

  SendClientMessage(playerid, COLOR_DCHAT, "LIVE >> {ffffff}Ai primit freeze. Te vei putea misca dupa ce se va termina live-ul.");

  SCMf(LiveOffer[playerid], COLOR_DCHAT, "LIVE >> {ffffff}%s accepted live interview.", GetName(playerid));

  SCM(LiveOffer[playerid], COLOR_DCHAT, "LIVE >> {ffffff}Ai primit freeze. Te vei putea misca dupa ce vei termina live-ul.");

  TogglePlayerControllable(playerid, 0);

  TogglePlayerControllable(LiveOffer[playerid], 0);

 

  if(TalkingLive[LiveOffer[playerid]] == 0) save_raport(LiveOffer[playerid], 6);

  TalkingLive[playerid] = 1;

  TalkingLive[LiveOffer[playerid]] = 1;

  LiveOffer[playerid] = 999;

 }

 else if(strcmp(item, "drugs", true) == 0) {

  if(DrugOffer[playerid] >= 999) return 1;

  if(PlayerInfo[playerid][pConnectTime] < 5) return SCM(playerid, -1, "Ai nevoie de minim 5 ore pentru a putea cumpara droguri.");

  if(DrugOffer[playerid] != id) return SCM(playerid, -1, "This player has not offered you drugs.");

  if(GetPlayerCash(playerid) < DrugPrice[playerid]) return SCM(playerid, -1, "Nu ai bani.");

  if(!IsPlayerConnected(DrugOffer[playerid])) return SCM(playerid, -1, "Acel player nu este conectat.");

  if(PlayerInfo[playerid][pDrugs] > 50) return SCM(playerid, -1, "You are fully loaded with drugs, use them first.");

  SCMf(playerid, COLOR_DCHAT, "TRADE >> {ffffff}You bought %d gram for $%d from Drug Dealer %s.", DrugGram[playerid], DrugPrice[playerid], GetName(DrugOffer[playerid]));

  SCMf(DrugOffer[playerid], COLOR_DCHAT, "TRADE >> {ffffff}%s has bought your %d gram, the $%d was added to your PayCheck.", GetName(playerid), DrugGram[playerid], DrugPrice[playerid]);

  GivePlayerCash(DrugOffer[playerid], DrugPrice[playerid]); GivePlayerCash(playerid, -DrugPrice[playerid]);

  PlayerInfo[playerid][pDrugs] += DrugGram[playerid]; PlayerInfo[DrugOffer[playerid]][pDrugs] -= DrugGram[playerid];

  pUpdateInt(DrugOffer[playerid], "Drugs", PlayerInfo[DrugOffer[playerid]][pDrugs]); pUpdateInt(playerid, "Drugs", PlayerInfo[playerid][pDrugs]);

   gString[0] = (EOS);

   mysql_format(SQL, gString, 300, "INSERT INTO `playerlogs` (`playerid` , `giverid` , `action`) VALUES ('%d', '%d', '%s sold %d drugs to %s for $%s')", PlayerInfo[playerid][pSQLID], PlayerInfo[DrugOffer[playerid]][pSQLID], GetName(DrugOffer[playerid]), DrugGram[playerid], GetName(playerid), FormatNumber(DrugPrice[playerid]));

     mysql_tquery(SQL, gString, "", "");

     DrugOffer[playerid] = 999; DrugPrice[playerid] = 0; DrugGram[playerid] = 0;

 }

 else if(strcmp(item, "repair", true) == 0) {

  if(RepairOffer[playerid] >= 999) return 1;

  if(RepairOffer[playerid] != id) return SCM(playerid, -1, "This player has not offered you repair.");

  if(GetPlayerCash(playerid) < RepairPrice[playerid]) return SCM(playerid, -1, "Nu ai bani.");

  if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, -1, "Nu te afli intr-un vehicul.");

  if(!IsPlayerConnected(RepairOffer[playerid])) return SCM(playerid, -1, "Acel player nu este conectat.");

  RepairCar[playerid] = GetPlayerVehicleID(playerid);

  SetVehicleHealth(RepairCar[playerid], 1000.0); RepairVehicle(RepairCar[playerid]);

  gString[0] = (EOS);

      mysql_format(SQL, gString, 300, "INSERT INTO `playerlogs` (`playerid` , `giverid` , `action`) VALUES ('%d', '%d', '%s repaired vehicle %s for $%s')", PlayerInfo[playerid][pSQLID], PlayerInfo[RepairOffer[playerid]][pSQLID], GetName(RepairOffer[playerid]), GetName(playerid), FormatNumber(RepairPrice[playerid]));

     mysql_tquery(SQL, gString, "", "");

     save_raport(RepairOffer[playerid], 1);

  RepairOffer[playerid] = 999; RepairPrice[playerid] = 0;

 }

 else if(strcmp(item, "hidden", true) == 0) {

  if(!IsPlayerConnected(hiddenoffer[playerid])) return SCM(playerid, -1, "Acel player nu este conectat.");

  if(hiddenoffer[playerid] != id) return SCM(playerid, -1, "This player has not offered you a hidden color.");

  if(PlayerInfo[hiddenoffer[playerid]][pPremiumPoints] < 20) return SCM(playerid, -1, "That player don't have 20 premium points.");

  if(PlayerInfo[id][pHiddenColor] < 1) return SCM(playerid, -1, "Acest jucator nu are destule culori.");

  if(GetPlayerCash(playerid) < hiddenprice[playerid]) return SCM(playerid, -1, "Nu ai bani.");

  PlayerInfo[playerid][pHiddenColor] ++; PlayerInfo[id][pHiddenColor] --;

  pUpdateInt(playerid, "HiddenColor", PlayerInfo[playerid][pHiddenColor]); pUpdateInt(id, "HiddenColor", PlayerInfo[id][pHiddenColor]);

  GivePlayerCash(playerid, -hiddenprice[playerid]); GivePlayerCash(hiddenoffer[playerid], hiddenprice[playerid]);

  SCMf(playerid, COLOR_DCHAT, "TRADE >> {ffffff}Ai cumparat o culoare hidden in schimbul sumei de $%s.", FormatNumber(hiddenprice[playerid]));

  SCMf(hiddenoffer[playerid], COLOR_DCHAT, "TRADE >> {ffffff}Ai primit $%s in schimbul unui hidden.", FormatNumber(hiddenprice[playerid]));

  gString[0] = (EOS);

     mysql_format(SQL, gString, 300, "INSERT INTO `playerlogs` (`playerid` , `giverid` , `action`) VALUES ('%d', '%d', '%s sold hidden %s for $%s')", PlayerInfo[playerid][pSQLID], PlayerInfo[hiddenoffer[playerid]][pSQLID], GetName(hiddenoffer[playerid]), GetName(playerid), FormatNumber(hiddenprice[playerid]));

     mysql_tquery(SQL, gString, "", "");

     hiddenoffer[playerid] = 999; hiddenprice[playerid] = 0; SellTradeTimer[id] = 0;

 }

 else if(strcmp(item, "tradecar", true) == 0) {

  if(!IsPlayerConnected(tradeofferer[playerid])) return SCM(playerid, -1, "Acel player nu este conectat.");

  if(tradeofferer[playerid] != id) return SCM(playerid, -1, "This player has not offered you a car.");

  if(GetPlayerCash(tradeofferer[playerid]) < tradediff[playerid]) return SCM(playerid, -1, "Nu ai bani.");

  new tid = tradeofferer[playerid], idcar1, idcar2;

  for(new vv; vv < MAX_PERSONAL_VEHICLES; vv++) { if(PlayerInfo[playerid][pCar][vv] == tradetype2[playerid]) idcar1 = vv; }

  for(new vv; vv < MAX_PERSONAL_VEHICLES; vv++) { if(PlayerInfo[tid][pCar][vv] == tradetype[playerid]) idcar2 = vv; }

  if(tradetype2[playerid] != PlayerInfo[playerid][pCar][idcar1]) return SendClientMessage(playerid, COLOR_WHITE, "Masina oferita numai este detinuta de tine.");

  if(tradetype[playerid] != PlayerInfo[tid][pCar][idcar2]) return SendClientMessage(playerid, COLOR_WHITE, "Acel jucator numai detine aceasta masina.");

  if(tradecars2[playerid] == PlayerInfo[playerid][pCarID][idcar1]) PlayerInfo[playerid][pCarID][idcar1] = tradecars[playerid];

  if(tradecars[playerid] == PlayerInfo[tid][pCarID][idcar2]) PlayerInfo[tid][pCarID][idcar2] = tradecars2[playerid];

  if(tradetype2[playerid] == PlayerInfo[playerid][pCar][idcar1]) PlayerInfo[playerid][pCar][idcar1] = tradetype[playerid];

  if(tradetype[playerid] == PlayerInfo[tid][pCar][idcar2]) PlayerInfo[tid][pCar][idcar2] = tradetype2[playerid];

  GivePlayerCash(tradeofferer[playerid], -tradediff[playerid]); GivePlayerCash(playerid, tradediff[playerid]);

  strmid(CarOwner[playerid][idcar1], PlayerInfo[playerid][pNormalName], 0, 50, 999);

  cUpdate(playerid, idcar1, cOwnerx);

  gString[0] = (EOS);

  mysql_format(SQL, gString, sizeof gString, "INSERT INTO `car_logs` (`playerid`, `playername`, `carid`, `text`) VALUES ('%d','%s','%d','%s traded car %d with %s (vehicle %d) with difference $%s')", PlayerInfo[playerid][pSQLID], PlayerInfo[playerid][pNormalName], PlayerInfo[playerid][pCar][idcar1], PlayerInfo[playerid][pNormalName], PlayerInfo[playerid][pCar][idcar1], GetName(tradeofferer[playerid]), PlayerInfo[tid][pCarID][idcar2], tradediff[playerid]);

  mysql_tquery(SQL, gString, "", "");

  strmid(CarOwner[tid][idcar2], PlayerInfo[tid][pNormalName], 0, 50, 999);

  cUpdate(tid, idcar2, cOwnerx);

  SCM(playerid, -1, "Afacerea s-a incheiat cu succes.");

  SCM(tid, -1, "Afacerea s-a incheiat cu succes.");

  SendAdmins(COLOR_ORANGE, "* %s traded his %s with %s's %s, with difference of $%s.", 1, GetName(tradeofferer[playerid]), aVehicleNames[PlayerInfo[tradeofferer[playerid]][pCarModel][idcar1] - 400], GetName(playerid), aVehicleNames[PlayerInfo[playerid][pCarModel][idcar2] - 400], FormatNumber(tradediff[playerid]));

  tradeofferer[playerid] = -1; tradediff[playerid] = 0; tradetype[playerid] = -1; tradetype2[playerid] = -1; tradecars[playerid] = -1; tradecars2[playerid] = -1; SellTradeTimer[id] = 0;

  LoadCar(playerid);

  LoadCar(tid);

  RemovePlayerFromVehicle(playerid); RemovePlayerFromVehicle(tid);

 }

 else if(strcmp(item, "dice", true) == 0) {

  if(PlayerInfo[playerid][pConnectTime] < 5) return SCM(playerid, -1, "Ai nevoie de minim 5 ore pentru a folosi aceasta actiune.");

  if(diceid[playerid] == 999) return SCM(playerid, -1, "Nobody invited you to play dice.");

  if(diceid[playerid] != id) return SCM(playerid, -1, "That player didn't invited you to play dice with him.");

  if(GetPlayerCash(playerid) < dicemoney[playerid]) return SCM(playerid, -1, "You or your adversary doesn't have enough money to play dice.");

  if(GetPlayerCash(id) < dicemoney[playerid]) return SCM(playerid, -1, "You or your adversary doesn't have enough money to play dice.");

  if(GetDistanceBetweenPlayers(playerid, diceid[playerid]) > 10) return SCM(playerid, -1, "Nu te afli langa acel player.");

  new dice1[MAX_PLAYERS], dice2[MAX_PLAYERS], total[MAX_PLAYERS];

     dice1[playerid] = random(6) + 1; dice2[playerid] = random(6) + 1; total[playerid] = dice1[playerid] + dice2[playerid];

     dice1[diceid[playerid]] = random(6) + 1; dice2[diceid[playerid]] = random(6) + 1;

     total[diceid[playerid]] = dice1[diceid[playerid]] + dice2[diceid[playerid]];

     if(total[playerid] > total[diceid[playerid]]) {

   GivePlayerCash(playerid, dicemoney[playerid]);

   GivePlayerCash(diceid[playerid], -dicemoney[playerid]);

      new log[128];

      format(log, 128, "%s win dice $%s wih %s", GetName(playerid), FormatNumber(dicemoney[playerid]), GetName(diceid[playerid]));

   insert_trade_logs(PlayerInfo[playerid][pSQLID], PlayerInfo[diceid[playerid]][pSQLID], GetName(playerid), GetName(diceid[playerid]), log);

   SCMf(playerid, COLOR_GREEN, "(+) You won $%s!", FormatNumber(dicemoney[playerid]));

   SCMf(diceid[playerid], COLOR_GREEN, "(-) You lost $%s!", FormatNumber(dicemoney[playerid]));

  }

  if(total[diceid[playerid]] > total[playerid]) {

   GivePlayerCash(playerid, -dicemoney[playerid]);

   GivePlayerCash(diceid[playerid], dicemoney[playerid]);

      new log[128];

      format(log, 128, "%s win dice $%s wih %s", GetName(diceid[playerid]), FormatNumber(dicemoney[playerid]), GetName(playerid));

   insert_trade_logs(PlayerInfo[diceid[playerid]][pSQLID], PlayerInfo[playerid][pSQLID], GetName(diceid[playerid]), GetName(playerid), log);

 

   SCMf(diceid[playerid], COLOR_GREEN, "(+) You won $%s!", FormatNumber(dicemoney[playerid]));

   SCMf(playerid, COLOR_GREEN, "(-) You lost $%s!", FormatNumber(dicemoney[playerid]));

  }

  if(total[diceid[playerid]] == total[playerid]) {

   SCM(diceid[playerid], -1, "Equal.");

   SCM(playerid, -1, "Equal.");

  }

  if(quest_type[playerid] == quest_barbut) quest_finish(playerid);

  if(quest_type[diceid[playerid]] == quest_barbut) quest_finish(diceid[playerid]);

  diceid[playerid] = 999; dicemoney[playerid] = 0;

 }

    else if(strcmp(item, "car", true) == 0) {

     if(!IsPlayerConnected(ofercar[playerid])) return SCM(playerid, -1, "Acel player nu este conectat.");

     if(ofercar[playerid] != id) return SCM(playerid, -1, "This player has not offered you a car.");

     if(GetPlayerCash(playerid) < carprice[playerid]) return SCM(playerid, -1, "Nu ai bani.");

     new idcar1, idcar2, total;

     if(GetDistanceBetweenPlayers(playerid, id) > 15) return SCM(playerid, -1, "Nu esti langa acel player.");

  for(new v; v < MAX_PERSONAL_VEHICLES; v++) {

   if(PlayerInfo[playerid][pCar][v] != -1) total++;

  }

  if(total+1 > PlayerInfo[playerid][pCarSlots]) return SCM(playerid, COLOR_WHITE, "Nu ai sloturi disponibile.");

  for(new v; v < PlayerInfo[playerid][pCarSlots]; v++) {

   if(PlayerInfo[playerid][pCar][v] == -1) {

    idcar1 = v;

    break;

   }

  }

  for(new v; v < PlayerInfo[id][pCarSlots]; v++) {

   if(PlayerInfo[id][pCar][v] == cartype[playerid]) idcar2 = v;

  }

  if(cartype[playerid] != PlayerInfo[id][pCar][idcar2]) return SendClientMessage(playerid, COLOR_WHITE, "Acel jucator nu mai detine aceasta masina.");

  PlayerInfo[playerid][pCar][idcar1] = PlayerInfo[id][pCar][idcar2]; PlayerInfo[playerid][pCarID][idcar1] = PlayerInfo[id][pCarID][idcar2];

  PlayerInfo[id][pCar][idcar2] = -1; PlayerInfo[id][pCarID][idcar2] = 0; SellTradeTimer[id] = 0;

  gString[0] = (EOS);

  mysql_format(SQL, gString, sizeof gString, "INSERT INTO `car_logs` (`playerid`, `playername`, `carid`, `text`) VALUES ('%d','%s','%d','%s selld vehicle %d to %s with $%s')", PlayerInfo[ofercar[playerid]][pSQLID], PlayerInfo[ofercar[playerid]][pNormalName], PlayerInfo[playerid][pCar][idcar1], PlayerInfo[ofercar[playerid]][pNormalName], PlayerInfo[playerid][pCar][idcar1], GetName(playerid), carprice[playerid]);

  mysql_tquery(SQL, gString, "", "");

  LoadCar(playerid);

  LoadCar(id);

  sendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "* %s sold his %s [vehicle: %d] to %s for $%s.",GetName(ofercar[playerid]),aVehicleNames[PlayerInfo[playerid][pCarModel][idcar1] - 400],PlayerInfo[playerid][pCar][idcar1],GetName(playerid),FormatNumber(carprice[playerid]));

  SendAdmins(COLOR_YELLOW, "* %s sold his %s [vehicle: %d] to %s for $%s.", 1, GetName(ofercar[playerid]), aVehicleNames[PlayerInfo[playerid][pCarModel][idcar1] - 400], PlayerInfo[playerid][pCar][idcar1], GetName(playerid), FormatNumber(carprice[playerid]));

  SendClientMessage(id, COLOR_WHITE, "The sell/trade car offer has expired.");

  RemovePlayerFromVehicleEx(ofercar[playerid]);

  GivePlayerCash(playerid, -carprice[playerid]); GivePlayerCash(ofercar[playerid], carprice[playerid]);

  strmid(CarOwner[playerid][idcar1], PlayerInfo[playerid][pNormalName], 0, 50, 999);

  cUpdate(playerid, idcar1, cOwnerx);

  strmid(CarOwner[id][idcar2], PlayerInfo[id][pNormalName], 0, 50, 999);

  cUpdate(id, idcar2, cOwnerx);

  gString[0] = (EOS);

     mysql_format(SQL, gString, 300, "INSERT INTO `playerlogs` (`playerid` , `giverid` , `action`) VALUES ('%d', '%d', '%s sold his %s [car: %d] to %s for $%s')", PlayerInfo[playerid][pSQLID], PlayerInfo[ofercar[playerid]][pSQLID] , GetName(ofercar[playerid]), aVehicleNames[PlayerInfo[playerid][pCarModel][idcar1] - 400], PlayerInfo[playerid][pCar][idcar1], GetName(playerid), FormatNumber(carprice[playerid]));

     mysql_tquery(SQL, gString, "", "");

  ofercar[playerid] = -1; carprice[playerid] = 0; primesccar[playerid] = 0; cartype[playerid] = 0;

  LoadCar(playerid);

  LoadCar(id);

  if(quest_type[playerid] == quest_sellcar) quest_finish(playerid);

    } else {

     SCM(playerid, -1, "Campuri invalide.");

     return 1;

    }

 return true; }

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.