Facebook
From YUSUF1452MEN, 1 Month ago, written in C#.
This paste is a reply to Re: CS 3 from YUSUF1452MEN - view diff
Embed
Download Paste or View Raw
Hits: 165
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. // Silah türlerini temsil eden sabitler
  6. #define PISTOL 1
  7. #define AK47 2
  8. #define SNIPER 3
  9.  
  10. // Takım isimlerini temsil eden sabitler
  11. #define TERRORISTS 1
  12. #define COUNTER_TERRORISTS 2
  13.  
  14. // Oyun modlarını temsil eden sabitler
  15. #define DEATHMATCH 1
  16. #define TEAM_DEATHMATCH 2
  17. #define CAPTURE_THE_FLAG 3
  18. #define BOMB_DEFUSAL 4
  19.  
  20. // Oyuncu yapısı
  21. typedef struct {
  22.     char name[50];
  23.     int team;
  24.     int score;
  25.     int health;
  26.     int currentWeapon;
  27. } Player;
  28.  
  29. // Oyun durumu yapısı
  30. typedef struct {
  31.     int mode;
  32.     int timeRemaining;
  33.     int isRunning;
  34.     Player players[10];
  35. } GameState;
  36.  
  37. // Oyun başlatma fonksiyonu
  38. void startGame(GameState *game) {
  39.     // Oyun durumu başlatılıyor
  40.     game->mode = DEATHMATCH;
  41.     game->timeRemaining = 300; // 5 dakika
  42.     game->isRunning = 1;
  43.  
  44.     // Oyuncuların başlangıç durumları ayarlanıyor
  45.     for (int i = 0; i < 10; i++) {
  46.         Player *player = &game;->players[i];
  47.         player->score = 0;
  48.         player->health = 100;
  49.         player->currentWeapon = PISTOL;
  50.         if (i % 2 == 0) {
  51.             player->team = TERRORISTS;
  52.         } else {
  53.             player->team = COUNTER_TERRORISTS;
  54.         }
  55.     }
  56. }
  57.  
  58. // Ana oyun döngüsü
  59. void gameLoop(GameState *game) {
  60.     while (game->isRunning) {
  61.         // Oyun süresi kontrol ediliyor
  62.         if (game->timeRemaining <= 0) {
  63.             game->isRunning = 0;
  64.             printf("Oyun süresi doldu!n");
  65.             break;
  66.         }
  67.  
  68.         // Oyuncu hareketleri ve etkileşimleri burada işlenir
  69.         // Oyuncu pozisyonları, sağlık durumları, silahlar, vb. güncellenir
  70.  
  71.         // Oyun süresi azaltılıyor
  72.         game->timeRemaining--;
  73.     }
  74. }
  75.  
  76. int main() {
  77.     GameState game;
  78.     startGame(&game;);
  79.     gameLoop(&game;);
  80.     return 0;
  81. }
  82.