How do i do this
#1

How do i set a players pos when he's offline cuz thats what im trying to do
pawn Код:
CMD:ogethere(playerid, params[]) // Made by Wizza
{
    new playerb[32], string[128], file[32];
    new Float:Pos[3];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(sscanf(params, "s[32]", playerb)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /ogethere [playername]");
    if(RPIDFN(playerb) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /gethere instead.");
    format(file, sizeof(file), "users/%s.ini", playerb);
    if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
    if(PlayerInfo[playerid][pAdmin] < dini_Int(file, "Admin")) return SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you.");
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    SetPlayerPos(playerb, Pos[0]+1, Pos[1], Pos[2]);
    SetPlayerInterior(playerb, GetPlayerInterior(playerid));
    SetPlayerVirtualWorld(playerb, GetPlayerVirtualWorld(playerid));
    format(string, sizeof(string), "%s has offline gotten %s to his location", Wizza(playerid), playerb);
    SendAdminMessage(COLOR_DARKRED, 1, string);
    format(string, sizeof(string), "%s has used /ogethere on %s", Wizza(playerid), playerb);
    Log("logs/users.log", string);
    return 1;
}
Reply
#2

Save the position in their file and load it/set it when they spawn (if they're logged in of course). Probably want to save the world & interior as well.
Reply
#3

How do i do that hm?
Reply
#4

dini_FloatSet & dini_IntSet inside of that command.
Reply
#5

Can you please set that for me i already showed you my code..
Reply
#6

pawn Код:
new bool:NeedsTP[MAX_PLAYERS];

CMD:ogethere(playerid, params[]) // Made by Wizza
{
    new playerb[32], string[128], file[32];
    new Float:Pos[3];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(sscanf(params, "s[32]", playerb)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /ogethere [playername]");
    if(RPIDFN(playerb) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /gethere instead.");
    format(file, sizeof(file), "users/%s.ini", playerb);
    if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
    if(PlayerInfo[playerid][pAdmin] < dini_Int(file, "Admin")) return SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you.");
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    SetPlayerPos(playerb, Pos[0]+1, Pos[1], Pos[2]);
    SetPlayerInterior(playerb, GetPlayerInterior(playerid));
    SetPlayerVirtualWorld(playerb, GetPlayerVirtualWorld(playerid));
    format(string, sizeof(string), "%s has offline gotten %s to his location", Wizza(playerid), playerb);
    SendAdminMessage(COLOR_DARKRED, 1, string);
    format(string, sizeof(string), "%s has used /ogethere on %s", Wizza(playerid), playerb);
    Log("logs/users.log", string);
   
    dini_FloatSet(file, "LastTpX", Pos[0]+1);
    dini_FloatSet(file, "LastTpY", Pos[1]);
    dini_FloatSet(file, "LastTpZ", Pos[2]);
    dini_IntSet(file, "LastTpVW", GetPlayerVirtualWorld(playerid));
    dini_IntSet(file, "LastTpINT", GetPlayerInterior(playerid));
   
    dini_IntSet(file, "NeedsTP", 1);
    return 1;
}

//On login
new file[32];
format(file, sizeof(file), "users/%s.ini", Wizza(playerid)); //if wizza is a getname func lol
if(fexist(file)) {
    if(dini_Int(file, "NeedsTP")) {
        NeedsTP[playerid]=true;
    } else {
        NeedsTP[playerid]=false;
    }
}

public OnPlayerSpawn(playerid)
{
    if(NeedsTP[playerid]) {
        SetPlayerVirtualWorld(playerid, dini_Int(file, "LastTpVW"));
        SetPlayerInterior(playerid, dini_Int(file, "LastTpINT"));
        SetPlayerPos(playerid, dini_Float(file, "LastTpX"), dini_Float(file, "LastTpY"), dini_Float(file, "LastTpZ"));
        NeedsTP[playerid]=false;
        new file[32];
        format(file, sizeof(file), "users/%s.ini", Wizza(playerid)); //if wizza is a getname function
        dini_IntSet(file, "NeedsTP", 0);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)