16.02.2019, 10:39
So when I log in it sometimes spawn's the player in the air and they fall to there death, I don't know why this happens.
In the database it's the same coordinates for the ground position so...
In the database it's the same coordinates for the ground position so...
Code:
forward OnPlayerLogin(playerid); public OnPlayerLogin(playerid) { new found = 0; new pName[24], str[256]; static a,b,c,d; cache_get_value_name_int(0, "Admin", a); cache_get_value_name_int(0, "PassedRPTest", b); cache_get_value_name_int(0, "CharacterMade", c); cache_get_value_name_int(0, "AppMade", d); SetPVarInt(playerid, "Admin", a); SetPVarInt(playerid, "PassedRPTest", b); SetPVarInt(playerid, "CharacterMade", c); SetPVarInt(playerid, "AppMade", d); PlayerInfo[playerid][LoggedIn] = true; new fetch[256]; cache_get_value_name(0, "AdminName", fetch); format(PlayerInfo[playerid][AdminName], 256, fetch); for(new i = 0; i < MAX_APPLICATIONS; i++) { if(ApplicationInfo[i][SentIn] == 1) { found++; } } if(GetPVarInt(playerid, "Admin") >= 1 || IsPlayerAdmin(playerid)) { if(found > 0) { format(str, sizeof(str), "Server: There are currently (%d) applications waiting approval. (/applications)", found); SendClientMessage(playerid, COLOR_ORANGE, str); } } if(GetPVarInt(playerid, "CharacterMade") == 0) { if(GetPVarInt(playerid, "PassedRPTest") == 0) { if(GetPVarInt(playerid, "AppMade") == 1) { SendClientMessage(playerid, COLOR_ORANGE, "Server: It looks like you have already done an application to join our server."); SendClientMessage(playerid, COLOR_ORANGE, "We are sorry it's taking so long for you to be reviewed, Please have patients, Thanks."); SendClientMessage(playerid, COLOR_ORANGE, "Would you like to take a multi-choice test?"); ShowPlayerDialog(playerid, TakeMultiChoice, DIALOG_STYLE_MSGBOX, "Take a different test?", "Would you like to take the multiple choice test?", "Yes", "No"); static apid; cache_get_value_name_int(0, "AppID", apid); PlayerInfo[playerid][AppID] = apid; ApplicationInfo[PlayerInfo[playerid][AppID]][PlayerID] = playerid; } if(GetPVarInt(playerid, "AppMade") == 0) { AdminsOnline(playerid); SetPVarInt(playerid, "Questions", 1); } SetSpawnInfo(playerid, 0, 305, 1494.8589, 1306.48, 1093.2953, 269.15, 0, 0, 0, 0, 0, 0 ); SetPlayerInterior(playerid,3); SetPlayerVirtualWorld(playerid, playerid+1); SpawnPlayer(playerid); SetPlayerSkin(playerid, 305); TogglePlayerSpectating(playerid, 0); TextDrawShowForPlayer(playerid,MoneyDraw[playerid]); return 1; } else { SendClientMessage(playerid, COLOR_ORANGE, "Server: Logged in, please make your character."); SetSpawnInfo(playerid, 0, 305, 1494.8589, 1306.48, 1093.2953, 269.15, 0, 0, 0, 0, 0, 0 ); SetPlayerInterior(playerid,3); SetPlayerVirtualWorld(playerid, playerid+1); SpawnPlayer(playerid); SetPlayerSkin(playerid, 305); ShowCreateCharacterMenu(playerid); TogglePlayerSpectating(playerid, 0); TextDrawShowForPlayer(playerid,MoneyDraw[playerid]); return 1; } } static e,f,j,k,l,m,n,Float:o,Float:p,Float:q,Float:r; cache_get_value_name_int(0, "Skin", e); cache_get_value_name_int(0, "Sex", f); cache_get_value_name_int(0, "Age", j); cache_get_value_name_int(0, "Cash", k); cache_get_value_name_int(0, "Bank", l); cache_get_value_name_int(0, "Interior", m); cache_get_value_name_int(0, "VirtualWorld", n); cache_get_value_name_float(0, "PosX", o); cache_get_value_name_float(0, "PosY", p); cache_get_value_name_float(0, "PosZ", q); cache_get_value_name_float(0, "PosA", r); //Why you need this instead just using var? SetPVarInt(playerid, "Skin", e); SetPVarInt(playerid, "Sex", f); SetPVarInt(playerid, "Age", j); SetPVarInt(playerid, "Cash", k); SetPVarInt(playerid, "Bank", l); SetPVarInt(playerid, "Interior", m); SetPVarInt(playerid, "VirtualWorld", n); SetPVarFloat(playerid, "PosX", o); SetPVarFloat(playerid, "PosY", p); SetPVarFloat(playerid, "PosZ", q); SetPVarFloat(playerid, "PosA", r); cache_get_value_name_int(0, "PrimWep", j); cache_get_value_name_int(0, "SecondWep", k); cache_get_value_name_int(0, "MeeleWep", l); cache_get_value_name_int(0, "PrimAmmo", m); cache_get_value_name_int(0, "SecondAmmo", n); SetPVarInt(playerid, "MeeleWeapon", l); SetPVarInt(playerid, "PrimaryWeapon", j); SetPVarInt(playerid, "SecondaryWeapon", k); SetPVarInt(playerid, "PrimaryAmmo", m); SetPVarInt(playerid, "SecondaryAmmo", n); GetPlayerName(playerid, pName, 24); GiveNameSpace(pName); format(str, sizeof(str), "Server: Welcome back %s, Thank you for being part of the community.", pName); SendClientMessage(playerid, COLOR_ORANGE, str); SetSpawnInfo(playerid, 0, GetPVarInt(playerid, "Skin"), GetPVarFloat(playerid, "PosX"), GetPVarFloat(playerid, "PosY"), GetPVarFloat(playerid, "PosZ"), GetPVarFloat(playerid, "PosA"), 0, 0, 0, 0, 0, 0 ); SetPlayerInterior(playerid, GetPVarInt(playerid, "Interior")); SetPlayerVirtualWorld(playerid, GetPVarInt(playerid, "VirtualWorld")); SpawnPlayer(playerid); SetCameraBehindPlayer(playerid); SetPlayerSkin(playerid, GetPVarInt(playerid, "Skin")); PlayerInfo[playerid][AppID] = -1; TogglePlayerSpectating(playerid, 0); TextDrawShowForPlayer(playerid,MoneyDraw[playerid]); SetPlayerMoneyEx(playerid, GetPVarInt(playerid, "Cash")); return 1; }