Help with Saving/Loading Player Positions. EASY
#8

This would do it, post in here if you get any errors or use my PM

pawn Код:
if (dialogid == 1)
    {
        new name[MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), "RicAdmin/users/%s.ini", 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][AdminLevel] = 0);
        dini_IntSet(file, "Cash",PlayerInfo[playerid][Cash] = 500);
        dini_IntSet(file, "Score",PlayerInfo[playerid][Score] = 0);
        dini_IntSet(file, "Job",PlayerInfo[playerid][Job] = 0);
        dini_IntSet(file, "Color",PlayerInfo[playerid][Color] = 0);
        dini_IntSet(file, "Vw",PlayerInfo[playerid][Vw] = 0);
        dini_IntSet(file, "Int",PlayerInfo[playerid][Int] = 0);
        dini_IntSet(file, "Warns",PlayerInfo[playerid][Warns] = 0);
        dini_IntSet(file, "Fleader",PlayerInfo[playerid][Fleader] = 0);
        dini_IntSet(file, "Fmember",PlayerInfo[playerid][Fmember] = 0);
        dini_IntSet(file, "Bank",PlayerInfo[playerid][Bank] = 0);
        dini_IntSet(file, "Prods",PlayerInfo[playerid][Prods] = 0);
        dini_IntSet(file, "Skin",PlayerInfo[playerid][Skin] = 0);
        dini_IntSet(file, "RepairOffer",PlayerInfo[playerid][RepairOffer] = 0);
        dini_IntSet(file, "Credit",PlayerInfo[playerid][Credit] = 0);
        dini_IntSet(file, "Spawn X", 0);
        dini_IntSet(file, "Spawn Y", 0);
        dini_IntSet(file, "Spawn Z", 0);
        dini_IntSet(file, "Spawn A", 0);
        dini_IntSet(file, "First login", 1);
        format(string, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", name, inputtext);
        SendClientMessage(playerid, 0xFF00CC, string);
        IsLogged[playerid] = 1;
    }
   
public OnPlayerDisconnect(playerid, reason)
{
    new name[24];
    GetPlayerName(playerid,name,24);
    format(file,sizeof(file),"RicAdmin/users/%s.ini",name);
    if(dini_Exists(file))
    {
        new Float:x, Float:y, Float:z, Float:a;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, a);
        dini_IntSet(file,"Cash",GetPlayerMoney(playerid));
        dini_IntSet(file,"Score",GetPlayerScore(playerid));
        dini_IntSet(file,"Color",GetPlayerColor(playerid));
        dini_IntSet(file,"AdminLevel",PlayerInfo[playerid][AdminLevel]);
        dini_IntSet(file,"Job",PlayerInfo[playerid][Job]);
        dini_IntSet(file,"Vw",GetPlayerVirtualWorld(playerid));
        dini_IntSet(file,"Int",GetPlayerInterior(playerid));
        dini_IntSet(file,"Warns",PlayerInfo[playerid][Warns]);
        dini_IntSet(file,"Fleader",PlayerInfo[playerid][Fleader]);
        dini_IntSet(file,"Fmember",PlayerInfo[playerid][Fmember]);
        dini_IntSet(file,"Bank",PlayerInfo[playerid][Bank]);
        dini_IntSet(file,"Prods",PlayerInfo[playerid][Prods]);
        dini_IntSet(file,"Skin",GetPlayerSkin(playerid));
        dini_IntSet(file,"RepairOffer",PlayerInfo[playerid][RepairOffer]);
        dini_IntSet(file,"Credit",PlayerInfo[playerid][Credit]);
        dini_IntSet(file, "Spawn X", x);
        dini_IntSet(file, "Spawn Y", y);
        dini_IntSet(file, "Spawn Z", z);
        dini_IntSet(file, "Spawn A", a);
        if(dini_Int(file, "First login") == 1) return dini_IntSet(file, "First login", 0);
        if(dini_Int(file, "First login") == 0) return dini_IntSet(file, "First login", 0);
        IsLogged[playerid] = 0;
        return 1;
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
    new name[MAX_PLAYER_NAME], file[128];
    GetPlayerName(playerid,name,sizeof(name));
    format(file,sizeof(file),"RicAdmin/users/%s.ini",name);
    if(dini_Int(file, "First login") == 1) return SetPlayerPos(playerid, 1186.534301, -1830.901367, 13.297243);
    if(dini_Int(file, "First login") == 0) return SetPlayerPos(playerid,dini_Int(file, "Spawn X"), dini_Int(file, "Spawn Y"), dini_Int(file, "Spawn Z"));
    SetPlayerFacingAngle(playerid, dini_IntSet(file, "Spawn A"));
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)