open.mp forum
what is this? - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: General (https://forum.open.mp/forumdisplay.php?fid=19)
--- Forum: Chat (https://forum.open.mp/forumdisplay.php?fid=20)
--- Thread: what is this? (/showthread.php?tid=3142)



what is this? - Axzyl - 2025-03-28

(40) : warning 213: tag mismatch: expected tag none ("_"), but found "Float"
(40) : warning 213: tag mismatch: expected tag none ("_"), but found "Float"
(41) : warning 213: tag mismatch: expected tag none ("_"), but found "Float"
(41) : warning 213: tag mismatch: expected tag none ("_"), but found "Float"
(49) : warning 213: tag mismatch: expected tag none ("_"), but found "Float"
(59) : warning 239: literal array/string passed to a non-const parameter
(121) : warning 203: symbol is never used: "banish"
(121) : warning 203: symbol is never used: "ghosthunt"
(121) : warning 203: symbol is never used: "radar"
///////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <a_samp>
#include <a_players>
#include <a_vehicles>
#include <a_npc>
#include <a_objects>

#define GHOST_VEHICLE_ID 487
#define GHOST_HUNTER_SKIN 20
#define GHOST_VAN_MODEL 487
#define GHOST_HUNTER_TEAM 1

new g_Hunters[MAX_PLAYERS];

stock SpawnGhostVan(playerid) {
    new Float:x, Float:y, Float:z, Float:angle;
    GetPlayerPos(playerid, x, y, z);
    angle = GetPlayerFacingAngle(playerid);

    vehicleid = AddStaticVehicle(GHOST_VEHICLE_ID, x + 5.0, y + 5.0, z, angle, 0, 0);
    SetVehicleInvulnerable(vehicleid, 1);
    SetVehicleColor(vehicleid, 0, 0);
    return vehicleid;
}

CMD:ghosthunt(playerid, params[]) {
    if (g_Hunters[playerid] == 1) {
        SendClientMessage(playerid, 0xFF0000FF, "You are already a Ghost Hunter!");
        return 1;
    }

    g_Hunters[playerid] = 1;
    SetPlayerSkin(playerid, GHOST_HUNTER_SKIN);
    SendClientMessage(playerid, 0x00FF00FF, "You are now a Ghost Hunter! Use your Ghost Van to track and defeat paranormal creatures!");
    SpawnGhostVan(playerid);
    return 1;
}

stock SpawnGhost() {
    new Float:x, Float:y, Float:z;
    x = random_float(-2500.0, 2500.0);
    y = random_float(-2500.0, 2500.0);
    z = 1000.0;

    AddPlayerClass(26, x, y, z, 180.0, 0, 0, 0, 0, 0, 0);
    return 1;
}

stock random_float(min, max) {
    return min + (random(max - min) / 1000.0);
}

stock random_int(min, max) {
    return random(max - min) + min;
}

public RandomGhostEvent();

public OnGameModeInit() {
    SetTimer("RandomGhostEvent", 60000, true);
    return 1;
}

public RandomGhostEvent() {
    if (random_int(0, 10) > 5) {
        SpawnGhost();
    }
    return 1;
}

CMD:radar(playerid, params[]) {
    if (g_Hunters[playerid] == 0) {
        SendClientMessage(playerid, 0xFF0000FF, "You need to be a Ghost Hunter to use the radar!");
        return 1;
    }

    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);

    for (new i = 0; i < MAX_PLAYERS; i++) {
        if (IsPlayerConnected(i) && g_Hunters[i] == 0) {
            new Float gx, Float gy, Float gz;
            GetPlayerPos(i, gx, gy, gz);
            if (GetDistanceBetweenCoords(x, y, z, gx, gy, gz) < 50.0) {
                SendClientMessage(playerid, 0x00FF00FF, "Ghost detected nearby! Use your van to track it down!");
            }
        }
    }
    return 1;
}

CMD:banish(playerid, params[]) {
    if (g_Hunters[playerid] == 0) {
        SendClientMessage(playerid, 0xFF0000FF, "You need to be a Ghost Hunter to use the banish ability!");
        return 1;
    }

    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);

    for (new i = 0; i < MAX_PLAYERS; i++) {
        if (IsPlayerConnected(i) && g_Hunters[i] == 0) {
            new Float gx, Float gy, Float gz;
            GetPlayerPos(i, gx, gy, gz);
            if (GetDistanceBetweenCoords(x, y, z, gx, gy, gz) < 50.0) {
                SendClientMessage(playerid, 0x00FF00FF, "Ghost successfully banished!");
                return 1;
            }
        }
    }

    SendClientMessage(playerid, 0xFF0000FF, "No ghost nearby to banish!");
    return 1;
}

public OnPlayerEnterCheckpoint(playerid) {
    if (g_Hunters[playerid] == 1) {
        SendClientMessage(playerid, 0x0000FFFF, "You're near a haunted spot. Use your radar to find ghosts!");
    }
    return 1;
}