Guest User

// tow //despawn & spawn

a guest
Feb 10th, 2017
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. case 2: { // tow
  2. if(CarInfo[vsid][Spawned] == 0) return SendClientMessage(playerid, COLOR_YELLOW2, "Error: Your car isn't spawned!");
  3. if(PlayerInfo[playerid][pCash] < 500) return SendClientMessage(playerid, COLOR_YELLOW2, "Error: Your don't have $500!");
  4. if(IsVehicleOccupied(CarInfo[vsid][Spawned])) return SendClientMessage(playerid, COLOR_YELLOW2, "Error: Vehicle is ocuppied!");
  5. SetTunning(vsid);
  6. SetVehicleToRespawn(CarInfo[vsid][Spawned]);GivePlayerCash(playerid, -500);
  7. SBizzInfo[5][sbTill] += 500;
  8. mysql_format(SQL, string,sizeof(string),"UPDATE sbizz SET Till = %d WHERE ID = %d",SBizzInfo[5][sbTill],5);
  9. mysql_tquery(SQL, string, "", "");
  10. format(string, sizeof(string), "{FFB870}Your %s is now at its parking place.", aVehicleNames[CarInfo[vsid][cModel]-400]);
  11. SendClientMessage(playerid, COLOR_WHITE, string);
  12. }
  13. ase 3: { // despawn & spawn
  14. if(CarInfo[vsid][Spawned] == 0) {
  15. CarInfo[vsid][Spawned] = CreateVehicle(CarInfo[vsid][cModel],CarInfo[vsid][cLocationx],CarInfo[vsid][cLocationy],CarInfo[vsid][cLocationz],CarInfo[vsid][cAngle],CarInfo[vsid][cColorOne],CarInfo[vsid][cColorTwo],-1);
  16. SetTunning(vsid);
  17. if(CarInfo[PlayerInfo[playerid][pCarKey1]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][0] = 1800;
  18. else if(CarInfo[PlayerInfo[playerid][pCarKey2]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][1] = 1800;
  19. else if(CarInfo[PlayerInfo[playerid][pCarKey3]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][2] = 1800;
  20. else if(CarInfo[PlayerInfo[playerid][pCarKey4]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][3] = 1800;
  21. else if(CarInfo[PlayerInfo[playerid][pCarKey5]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][4] = 1800;
  22. format(string, sizeof(string), "{FFB870}Your %s has been spawned.", aVehicleNames[CarInfo[vsid][cModel]-400]);
  23. SendClientMessage(playerid, COLOR_WHITE, string);
  24. mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Spawned='%d' WHERE ID=%d", CarInfo[vsid][Spawned], vsid);
  25. mysql_tquery(SQL, string, "", "");
  26.  
  27. }
  28. else {
  29. if(IsVehicleOccupied(CarInfo[vsid][Spawned])) return SendClientMessage(playerid, COLOR_YELLOW2, "Error: Vehicle is ocuppied!");
  30. if(CarInfo[PlayerInfo[playerid][pCarKey1]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][0] = -1;
  31. else if(CarInfo[PlayerInfo[playerid][pCarKey2]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][1] = -1;
  32. else if(CarInfo[PlayerInfo[playerid][pCarKey3]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][2] = -1;
  33. else if(CarInfo[PlayerInfo[playerid][pCarKey4]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][3] = -1;
  34. else if(CarInfo[PlayerInfo[playerid][pCarKey5]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][4] = -1;
  35. DestroyVehicle(CarInfo[vsid][Spawned]);
  36. CarInfo[vsid][Spawned] = 0;
  37. format(string, sizeof(string), "{FFB870}Your %s has been despawned.", aVehicleNames[CarInfo[vsid][cModel]-400]);
  38. SendClientMessage(playerid, COLOR_WHITE, string);
  39. mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Spawned='%d' WHERE ID=%d", CarInfo[vsid][Spawned], vsid);
  40. mysql_tquery(SQL, string, "", "");
Advertisement
Add Comment
Please, Sign In to add comment