Drift โพสต์ 2021-11-20 16:12:29

เวลาผู้เล่น Spawn จะให้รอประมาน 3 วิ ถึงจะเดินได้ทำไงคับ

************************************

jamgames โพสต์ 2021-11-20 18:16:30

ใช้ Timer ครับ นี้ตัวอย่าง
// The event callback (OnPlayerSpawn) - we will start a timer here
public OnPlayerSpawn(playerid)
{
    // Anti-Spawnkill (5 seconds)

    // Set their health very high so they can't be killed
    SetPlayerHealth(playerid, 999999);

    // Notify them
    SendClientMessage(playerid, -1, "You are protected against spawn-killing for 5 seconds.");

    // Start a 5 second timer to end the anti-spawnkill
    SetTimerEx("EndAntiSpawnKill", 5000, false, "i", playerid); //5000 = 5 Second
}

// Forward (make public) the function so the server can 'see' it
forward EndAntiSpawnKill(playerid);

// The timer function - the code to be executed when the timer is called goes here
public EndAntiSpawnKill(playerid)
{
    // 5 seconds has passed, so let's set their health back to 100
    SetPlayerHealth(playerid, 100);

    // Let's notify them also
    SendClientMessage(playerid, -1, "You are no longer protected against spawn-killing.");
    return 1;
}
หน้า: [1]
ดูในรูปแบบกติ: เวลาผู้เล่น Spawn จะให้รอประมาน 3 วิ ถึงจะเดินได้ทำไงคับ