22.09.2013, 13:22
Bom meu problema й o seguinte eu criei um sistema de salvar spawn vida e colete, sу que quando o player registra ele nasce caindo e morrendo, mas eu jб coloquei StPlayerHealth(); e o SetSpawnInfo(); e mesmo assim nгo funfo.
Variбveis:
OnPlayerSpawn:
Diбlogo do registro:
Stock que salva as informaзхes do player:
Variбveis:
pawn Код:
new Float:SpawnX[MAX_PLAYERS],
Float:SpawnY[MAX_PLAYERS],
Float:SpawnZ[MAX_PLAYERS];
new Float:Vida[MAX_PLAYERS],
Float:Colete[MAX_PLAYERS];
OnPlayerSpawn:
pawn Код:
public OnPlayerSpawn(playerid)
{
//StopAudioStreamForPlayer(playerid);
SpawnX[playerid] = DOF2_GetFloat(ReturnFileUser(playerid),"X");
SpawnY[playerid] = DOF2_GetFloat(ReturnFileUser(playerid),"Y");
SpawnZ[playerid] = DOF2_GetFloat(ReturnFileUser(playerid),"Z");
SetPlayerHealth(playerid, DOF2_GetFloat(ReturnFileUser(playerid),"Vida"));
SetPlayerArmour(playerid, DOF2_GetFloat(ReturnFileUser(playerid),"Colete"));
SetPlayerPos(playerid, SpawnX[playerid], SpawnY[playerid], SpawnZ[playerid]);
return 1;
}
pawn Код:
case DIALOG_REGISTRO:
{
if(!response) Kick(playerid);
if(response)
{
new Str[180];
format(Str, sizeof(Str), "{FAF0E6}nomedoserver, %s.\nEndereзo IP: %s.\nVocк pode registrar uma conta, digitando uma senha desejada aqui:\n", GetName(playerid), GetIp(playerid));
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT, "{0080FF}Registro", Str, "Registrar", "Sair");
DOF2_CreateFile(ReturnFileUser(playerid), inputtext);
DOF2_SaveFile();
SetSpawnInfo(playerid, 0, 0, 1715.3910, -1881.5157, 13.5665, 0.2859, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
GivePlayerMoney(playerid, 10000);
SetPlayerScore(playerid,0);
SetPlayerHealth(playerid, 50.0);
ToggleMainMenu(playerid, 0);
}
}
pawn Код:
stock Save_Player_Stats(playerid)
{
if(DOF2_FileExists(ReturnFileUser(playerid)))
{
GetPlayerPos(playerid, SpawnX[playerid], SpawnY[playerid], SpawnZ[playerid]);
GetPlayerHealth(playerid, Vida[playerid]);
GetPlayerArmour(playerid, Colete[playerid]);
DOF2_SetInt(ReturnFileUser(playerid),"Level",GetPlayerScore(playerid));
DOF2_SetInt(ReturnFileUser(playerid),"Dinheiro",GetPlayerMoney(playerid));
DOF2_SetInt(ReturnFileUser(playerid),"Admin Level",PlayerInfo[playerid][pAdmin]);
DOF2_SetInt(ReturnFileUser(playerid),"Skin",GetPlayerSkin(playerid));
DOF2_SetInt(ReturnFileUser(playerid),"Emprego",PlayerInfo[playerid][pEmprego]);
//DOF2_SetInt(ReturnFileUser(playerid),"Emprego Segundario",PlayerInfo[playerid][pEmprego2]);
DOF2_SetFloat(ReturnFileUser(playerid),"X", SpawnX[playerid]);
DOF2_SetFloat(ReturnFileUser(playerid),"Y", SpawnY[playerid]);
DOF2_SetFloat(ReturnFileUser(playerid),"Z", SpawnZ[playerid]);
DOF2_SetFloat(ReturnFileUser(playerid),"Vida", Vida[playerid]);
DOF2_SetFloat(ReturnFileUser(playerid),"Colete", Colete[playerid]);
DOF2_SaveFile();
}
}