missiontext textdraw help
#1

does anyone know How to make the mission text on a trucking server?

I know how to do the text draw but i dont know how to get it to show the mission you are on can anyone help?
Reply
#2

Just set a timer that will check every 3 seconnds whats the player mission and set it .....to the right one

if(mission[playerid] == 1)
{
TextdrawSetString(textdraw,"mission 1");
}
Reply
#3

sorry but i anit that good of a scripter where do i put it in my script?

this is the gm im making its very basic
pawn Код:
#include <a_samp>
#include <TruckingMissions>
#include <dini>
#include <dudb>
#define SERVER_USER_FILE "Accounts/%s.ini"
#define COLOR_YELLOW 0xDABB3EAA
#define COLOR_RED 0xAA3333AA
#define COLOR_GREEN 0x9EC73DAA
new gPlayerLogged[MAX_PLAYERS];
enum pInfo
{
    pAdminLevel,
    pCash,
    pScore,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
enum TruckingMissionInfo
{
    MissionName[200],
    bool:UseTrailerCheck,
    MissionPay,
    Float:loadx,
    Float:loady,
    Float:loadz,
    Float:unloadx,
    Float:unloady,
    Float:unloadz
}
new TruckingMissionRandom[][TruckingMissionInfo] =
{
        {"Deliver Holy Water from LVA Freight Depot to LVA Church", true, 10000, 1701.9475,940.5465,10.8203, 1496.2524,772.1427,10.8203},
        {"Deliver Junk Car Parts from LVA Freight Depot to Shody Ottos", true, 10000, 1701.9475,940.5465,10.8203, 1727.6351,1812.1750,10.8203}
};
new IsPlayerInMission[MAX_PLAYERS] = 0; // We are going to use this to detect when a player is in a mission!
main()
{
    print("\n---");
    print(" TEST");
    print("-----");
}
public OnGameModeInit()
{

    SetGameModeText("Trucking");
    //vehicles
    AddStaticVehicle(403,3915.8657226563,-1998.6021728516,12.290036201477,0,-1,-1);
    AddPlayerClass(181,2134.3069,-2158.5654,13.5469,249.3310,0,0,0,0,0,0); //
    return 1;
}
public OnGameModeExit()
{
    return 1;
}


SetupPlayerForClassSelection(playerid)
{
    SetPlayerInterior(playerid,14);
    SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
    SetPlayerFacingAngle(playerid, 270.0);
    SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
    SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
}

public OnPlayerRequestClass(playerid, classid)
{
    SetupPlayerForClassSelection(playerid);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid,0);
    TogglePlayerClock(playerid,0);
    return 1;
}

public OnPlayerConnect(playerid)
{
    gPlayerLogged[playerid] = 0;
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if (!dini_Exists(file))
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi your not registered", "Welcome, your not registered mate, input your registration pw below", "Register", "Leave");
    }
    if(fexist(file))
    {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi your registered", "Fucken awesome mate, your registered :D. Inpute your pw below", "Login", "Leave");
    }
    M_OnPlayerConnect(playerid);
    IsPlayerInMission[playerid] = 0;// reset
    return 1;
}


public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(gPlayerLogged[playerid] == 1)
    {
        dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]);
        dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]);
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
    }
    gPlayerLogged[playerid] = 0;
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/work", cmdtext, true))
    {
        new pvehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
        if (pvehiclemodel == 403 || pvehiclemodel == 514 || pvehiclemodel == 515)
        {
        if (IsPlayerInMission[playerid] == 1) return SendClientMessage(playerid, 0xFF0000AA, ">> You are currently in a mission use \"/cancelmission\" to cancel your current mission!"); // prevents them from starting another mission
        new string[200];
        new rand = random(sizeof(TruckingMissionRandom));
        IsPlayerInMission[playerid] = 1; // asign it to 1 becuase there in a mission
        CreatePlayerMission(playerid, TruckingMissionRandom[rand][UseTrailerCheck], TruckingMissionRandom[rand][MissionPay], TruckingMissionRandom[rand][loadx],TruckingMissionRandom[rand][loady], TruckingMissionRandom[rand][loadz], TruckingMissionRandom[rand][unloadx],TruckingMissionRandom[rand][unloady], TruckingMissionRandom[rand][unloadz]);
        format(string, sizeof(string), "You are doing mission: %s", TruckingMissionRandom[rand][MissionName]);
        SendClientMessage(playerid, 0x00FF00FF, string);
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Im sorry but this mission requires that you use a vehicle that can pull a semi trailer Ex: Roadtrain with an Artict1!");
        }
        return 1;
    }
    if(!strcmp("/cancelmission", cmdtext, true))
    {
        if (IsPlayerInMission[playerid] == 0) return SendClientMessage(playerid, 0xFF0000AA, "you are not in a mission use \"/work\" to start one!"); // prevents them if there currently not in a mission
        IsPlayerInMission[playerid] = 0; // resets it so they can start another mission
        CancelPlayersCurrentMission(playerid);
        return 1;
    }
    return 0;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    if (IsPlayerInMission[playerid] == 1)// checks to see if a player was in a mission on player death
    {
        CancelPlayersCurrentMission(playerid);// cancels player mission
        IsPlayerInMission[playerid] = 0; // resets the variable so they can start a new mission!
    }
    return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
    M_OnPlayerEnterCheckpoint(playerid);
    return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
    M_OnPlayerEnterRaceCheckpoint(playerid);
    return 1;
}
public OnPlayerFinishMission(playerid)
{
    SendClientMessage(playerid, 0x00FF00FF, "You have completed your mission!");
    return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 1)
    {
        new name[MAX_PLAYER_NAME], file[256], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi your not registered", "Welcome, your not registered mate, input your registration pw below", "Register", "Leave");
        dini_Create(file);
        dini_IntSet(file, "Password", udb_hash(inputtext));
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
        dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500);
        dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
        format(string, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", name, inputtext);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        gPlayerLogged[playerid] = 1;
    }
    if (dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[256];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "This account is registered in our data base.", "Enter your password below, or leave if you're a wrong person", "Login", "Leave");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp) {
            SendClientMessage(playerid, COLOR_RED, "SERVER: Invalid password.  Re-enter your password correctly or leave!");
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "This account is registered in our data base.", "Enter your password below, or leave if you're a wrong person", "Login", "Leave");
        }
        else
        {
            gPlayerLogged[playerid] = 1;
            PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
            SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
            GivePlayerMoney(playerid, dini_Int(file, "Money"));
            SendClientMessage(playerid,COLOR_GREEN, "SERVER: You have succesfully logged into your account.  Welcome back.");
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)