Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <a_players>
- new Float:botX, Float:botY, Float:botZ;
- new destinationX, destinationY, destinationZ;
- new Float:fare = 10.0;
- new playerToPickup = INVALID_PLAYER_ID;
- new playerConfirmation = INVALID_PLAYER_ID;
- public OnGameModeInit()
- {
- // Nastavení startovní pozice bota
- botX = 1000.0;
- botY = 1000.0;
- botZ = 5.0;
- // Nastavení intervalu pro akce bota každých 10 sekund
- SetTimer("BotActions", 10000, true);
- return 1;
- }
- public BotActions()
- {
- // Přivolání taxikáře, nastavení cílového waypointu a čekání na hráče
- CallTaxi();
- // Simulace čekání na hráče
- WaitForPlayer();
- // Simulace cesty k cíli
- TravelToDestination();
- // Simulace zaplacení za jízdu
- PayFare();
- return 1;
- }
- public CallTaxi()
- {
- printf("Bot: Volá taxikáře na číslo 11774. Napíši '/volamtaxi', pokud chceš jet.");
- // Simulovat zprávu nebo interakci s taxikářem
- return 1;
- }
- public WaitForPlayer()
- {
- if (playerConfirmation == INVALID_PLAYER_ID)
- {
- printf("Bot: Čeká na potvrzení od hráče. Napiš '/potvrdit', pokud chceš jet.");
- }
- else
- {
- printf("Bot: Hráč potvrdil jízdu. Připrav se na odjezd.");
- }
- return 1;
- }
- public TravelToDestination()
- {
- if (playerConfirmation != INVALID_PLAYER_ID)
- {
- destinationX = 1500.0;
- destinationY = 1500.0;
- destinationZ = 5.0;
- SetPlayerPos(playerToPickup, destinationX, destinationY, destinationZ);
- printf("Bot: Dorazil jsi na cíl. Děkujeme za jízdu!");
- }
- return 1;
- }
- public PayFare()
- {
- if (playerConfirmation != INVALID_PLAYER_ID)
- {
- if (IsPlayerConnected(playerToPickup))
- {
- GivePlayerMoney(playerToPickup, fare);
- printf("Bot: Hráč ID %d zaplatil taxikáři %.2f peněz.", playerToPickup, fare);
- }
- }
- // Resetovat hodnoty pro další jízdu
- playerToPickup = INVALID_PLAYER_ID;
- playerConfirmation = INVALID_PLAYER_ID;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp(cmdtext, "/volamtaxi", true) == 0)
- {
- playerToPickup = playerid;
- printf("Hráč ID %d volá taxikáře.", playerid);
- return 1;
- }
- else if (strcmp(cmdtext, "/potvrdit", true) == 0 && playerToPickup == playerid)
- {
- playerConfirmation = playerid;
- SendClientMessage(playerConfirmation, -1, "Taxikář potvrdil tvoji žádost o jízdu.");
- printf("Hráč ID %d potvrdil jízdu.", playerid);
- return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement