Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. if(dialogid == DIALOG_TARGAUTO2)
  2. {
  3.  
  4. if(!response) return 1;
  5. new string[256];
  6. new index;
  7. format(string, sizeof(string),"SELECT * FROM targauto Where Model = %d and Vanzator = '%s' And id = %d", ModelTarg[playerid], NumeTarg[playerid], IdTarg[playerid]);
  8. new Cache: Result = mysql_query( mysql, string), Get[ 2 ];
  9. cache_get_data( Get[ 0 ], Get[ 1 ], SQL ); // Get[ 0 ] - Rows || Get[ 1 ] - Fields || SQL - connectionHandle
  10. for(new i = 0; i < Get[0]; i++)
  11. {
  12. index ++;
  13. new pret,model,vanzator[50],color1,color2, Float: km;
  14. pret = cache_get_field_content_int( 0, "Pret", mysql );
  15. model = cache_get_field_content_int( 0, "Model", mysql );
  16. color1 = cache_get_field_content_int( 0, "Color1", mysql );
  17. color2 = cache_get_field_content_int( 0, "Color2", mysql );
  18. km = cache_get_field_content_float( 0, "KM", mysql );
  19. cache_get_field_content( 0, "Vanzator", vanzator, mysql, MAX_PLAYER_NAME );
  20. if(GetMoney(playerid) < pret) return GameTextForPlayer(playerid, "~R~NO CASH!", 4000 ,3);
  21. if(PlayerInfo[playerid][pVehicle1] != 0 && PlayerInfo[playerid][pVehicle2] != 0 && PlayerInfo[playerid][pVehicle3] != 0)
  22. { SendClientMessage(playerid, COLOR_GREY, "You cannot purchase any more vehicles as all 3 of your slots are full."); return 1; }
  23. if(PlayerInfo[playerid][pVehicle1] != 1)
  24. {
  25. TakeMoney(playerid,pret);
  26. if(strcmp(GetName(playerid),vanzator, false) == 0)
  27. {
  28. if(!IsPlayerOnline(vanzator))
  29. {
  30. mysql_format(mysql, string, sizeof(string), "UPDATE players SET `Money` = Money + %d WHERE 'Name' = '%s' AND `IsConnected` = 0", pret,vanzator);
  31. mysql_tquery(mysql, string, "", "");
  32. new stringquery[256];
  33. new notificare[200];
  34. format(notificare,200, "%s ti-a cumparat %s pus la targ.\nAi primit pentru vanzarea acestuia: %s$", GetName(playerid), VehicleNames[model - 400], FormatMoney(pret));
  35. format(stringquery,sizeof(stringquery), "INSERT INTO `notifications` (`name`, `continut`) VALUES ('%s', '%s')",
  36. vanzator, notificare);
  37. mysql_tquery(mysql, stringquery, "Notification", "");
  38. }
  39. else
  40. {
  41. foreach(new ig : Player)
  42. {
  43. if(strcmp(GetName(ig),vanzator, true) == 0)
  44. {
  45. GiveMoney(ig, pret);
  46. new stringbanuti[100];
  47. format(stringbanuti, 100, "%s ti-a cumparatat %s din targ. Ai primit: %s$", GetName(playerid), VehicleNames[model - 400], FormatMoney(pret));
  48. SCM(ig, COLOR_GRAD2, stringbanuti);
  49. }
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement