D:\samp037_svr_R2-1-1_win32\gamemodes\survive1.pwn(705) : warning 213: tag mismatch D:\samp037_svr_R2-1-1_win32\gamemodes\survive1.pwn(705) : error 032: array index out of bounds (variable "Player") D:\samp037_svr_R2-1-1_win32\gamemodes\survive1.pwn(722) : warning 213: tag mismatch D:\samp037_svr_R2-1-1_win32\gamemodes\survive1.pwn(722) : error 032: array index out of bounds (variable "Player") D:\samp037_svr_R2-1-1_win32\gamemodes\survive1.pwn(723) : warning 213: tag mismatch D:\samp037_svr_R2-1-1_win32\gamemodes\survive1.pwn(723) : error 032: array index out of bounds (variable "Player") D:\samp037_svr_R2-1-1_win32\gamemodes\survive1.pwn(723) : warning 213: tag mismatch Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase |
stock SavePlayer(playerid) { if( DOF2_FileExists( GetPlayerArquivo( playerid ) ) ) { DOF2_CreateFile(GetPlayerArquivo(playerid)); //DOF2_SetInt( GetPlayerArquivo( playerid ), "Skin", Player[ playerid ][ Skin ] ); DOF2_SetInt( GetPlayerArquivo( playerid ), "Score", Player[ playerid ][ Score ] ); DOF2_SetInt( GetPlayerArquivo( playerid ), "Dinheiro", GetPlayerMoney( playerid )); DOF2_SetInt( GetPlayerArquivo( playerid ), "Admin", Player[ playerid ][ Admin ] ); DOF2_SetInt( GetPlayerArquivo( playerid ), "AliveTime", Player[playerid][pDTime]); DOF2_SetInt( GetPlayerArquivo( playerid ), "Sede", Player[playerid][pSede]); DOF2_SaveFile(); } return 1; } stock LoadPlayer(playerid) { if( DOF2_FileExists( GetPlayerArquivo( playerid ) ) ) { //Player[ playerid ][ Skin ] = DOF2_GetInt( GetPlayerArquivo( playerid ), "Skin" ); Player[ playerid ][ Score ] = DOF2_GetInt( GetPlayerArquivo( playerid ), "Score" ); Player[ playerid ][ Dinheiro ] = DOF2_GetInt( GetPlayerArquivo( playerid ), "Dinheiro" ); Player[ playerid ][ Admin ] = DOF2_GetInt( GetPlayerArquivo( playerid ), "Admin" ); Player[ playerid ][ pDTime ] = DOF2_GetInt( GetPlayerArquivo(playerid), "Alive Time"); Player[ playerid ][ pSede ] = FloatOF2_GetFloat(GetPlayerArquivo(playerid),"Se de"); SetPlayerScore( playerid, Player[ playerid ][ Score ] ); //SetPlayerSkin(playerid, Player[ playerid ][ Skin ] ); } return 1; } |
Player[ playerid ][ pSede ] = DOF2_GetInt(GetPlayerArquivo(playerid),"Sede");
DOF2_SetInt( GetPlayerArquivo( playerid ), "AliveTime", Player[playerid][pDTime]); //Vocк salva com "AliveTime" Player[ playerid ][ pDTime ] = DOF2_GetInt( GetPlayerArquivo(playerid), "Alive Time"); //Mas tenta pegar seu valor com "Alive Time".
Player[ playerid ][ pDTime ] = DOF2_GetInt( GetPlayerArquivo(playerid), "AliveTime");
stock SavePlayer(playerid)
{
if(!DOF2_FileExists( GetPlayerArquivo( playerid ) ) )
DOF2_CreateFile(GetPlayerArquivo(playerid));
//DOF2_SetInt( GetPlayerArquivo( playerid ), "Skin", Player[ playerid ][ Skin ] );
DOF2_SetInt( GetPlayerArquivo( playerid ), "Score", Player[ playerid ][ Score ] );
DOF2_SetInt( GetPlayerArquivo( playerid ), "Dinheiro", GetPlayerMoney( playerid ));
DOF2_SetInt( GetPlayerArquivo( playerid ), "Admin", Player[ playerid ][ Admin ] );
DOF2_SetInt( GetPlayerArquivo( playerid ), "AliveTime", Player[playerid][pDTime]);
DOF2_SetInt( GetPlayerArquivo( playerid ), "Sede", Player[playerid][pSede]);
DOF2_SaveFile();
return 1;
}
DOF2_SetFloat(file[],key[],Float:value); //funзгo para Salvar Em Float
DOF2_GetFloat(file[], key[]); //Funзгo para pegar(getar) uma variavel Float
Se vocк salva a sede como um nъmero inteiro, vocк estб pegando seu valor como se fosse Float, caso o nъmero que atribui o nнvel de sede do jogador for inteiro, mude para:
Код:
Player[ playerid ][ pSede ] = DOF2_GetInt(GetPlayerArquivo(playerid),"Sede"); Код:
DOF2_SetInt( GetPlayerArquivo( playerid ), "AliveTime", Player[playerid][pDTime]); //Vocк salva com "AliveTime" Player[ playerid ][ pDTime ] = DOF2_GetInt( GetPlayerArquivo(playerid), "Alive Time"); //Mas tenta pegar seu valor com "Alive Time". Код:
Player[ playerid ][ pDTime ] = DOF2_GetInt( GetPlayerArquivo(playerid), "AliveTime"); A propуsito, vocк estб fazendo algo meio desnecessбrio no inнcio do cуdigo, criando outro arquivo (mesmo que este substitua o anterior) jб tendo um existente, irei lhe passar o algoritmo corrigido abaixo: PHP код:
Sу mais uma coisa, se vocк estб usando estas funзхes, nгo precisa colocar "stock" em seu nome |
main() {
new str[40], val = 1;
format(str, sizeof(str), "%03d", val); //format(str, sizeof(str), "%03i", val) й a mesma coisa, o especificador "d" e "i" equivalem a um numero inteiro
printf("%s", str);
}
stock SavePlayer(playerid) { if(!DOF2_FileExists( GetPlayerArquivo( playerid ) ) ) DOF2_CreateFile(GetPlayerArquivo(playerid)); //DOF2_SetInt( GetPlayerArquivo( playerid ), "Skin", Player[ playerid ][ Skin ] ); DOF2_SetInt( GetPlayerArquivo( playerid ), "Score", Player[ playerid ][ Score ] ); DOF2_SetInt( GetPlayerArquivo( playerid ), "Dinheiro", GetPlayerMoney( playerid )); DOF2_SetInt( GetPlayerArquivo( playerid ), "Admin", Player[ playerid ][ Admin ] ); DOF2_SetInt( GetPlayerArquivo( playerid ), "AliveTime", Player[playerid][pDTime]); DOF2_SetInt( GetPlayerArquivo( playerid ), "pSexo", Player[playerid][pSexo]); DOF2_SetInt( GetPlayerArquivo( playerid ),"pSede", pInfo[playerid][pSede]); DOF2_SaveFile(); return 1; } stock LoadPlayer(playerid) { if( DOF2_FileExists( GetPlayerArquivo( playerid ) ) ) { //Player[ playerid ][ Skin ] = DOF2_GetInt( GetPlayerArquivo( playerid ), "Skin" ); Player[ playerid ][ Score ] = DOF2_GetInt( GetPlayerArquivo( playerid ), "Score" ); Player[ playerid ][ Dinheiro ] = DOF2_GetInt( GetPlayerArquivo( playerid ), "Dinheiro" ); Player[ playerid ][ Admin ] = DOF2_GetInt( GetPlayerArquivo( playerid ), "Admin" ); Player[ playerid ][ pDTime ] = DOF2_GetInt( GetPlayerArquivo(playerid), "AliveTime"); Player[ playerid ][ pSexo ] = DOF2_GetInt( GetPlayerArquivo(playerid), "pSexo"); Player[ playerid ][ pSede ] = DOF2_GetInt( GetPlayerArquivo(playerid),"pSede"); SetPlayerScore( playerid, Player[ playerid ][ Score ] ); GivePlayerMoney( playerid, Player[ playerid] [ Dinheiro ] ); //SetPlayerSkin(playerid, Player[ playerid ][ Skin ] ); } return 1; } |
D:\samp037_svr_R2-1-1_win32\gamemodes\survive1.pwn(835) : warning 213: tag mismatch Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Warning. |
Player[ playerid ][ pSede ] = DOF2_GetInt( GetPlayerArquivo(playerid),"pSede"); |
enum Player_Data { bool: pConectado, pIdioma, pAdmin, pAviso, bool: pMute, bool: pBlockPM, pChat, pBackpack, pSlots, pFome, pSede, pRadiation, pReputation, pExp, pLevel, pRespawn, pSangrando, pQuebrado, pTemGPS, pTemColete, pTemCapacete }; new pInfo[MAX_PLAYERS][Player_Data]; |
public OnPlayerUpdate(playerid) { if(!IsPlayerNPC(playerid) && IsPlayerConnected(playerid)) { if(pInfo[playerid][pConectado] == true) { new str[200]; format(str, sizeof(str), "[~y~%s~w~]", PegarNome(playerid)); PlayerTextDrawSetString(playerid, PLAYER_HUD[playerid][22], str); format(str, sizeof(str), "%.0i%", pInfo[playerid][pFome]); PlayerTextDrawSetString(playerid, PLAYER_HUD[playerid][9], str); format(str, sizeof(str), "%.0i%", pInfo[playerid][pSede]); PlayerTextDrawSetString(playerid, PLAYER_HUD[playerid][13], str); if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { new vehicleid = GetPlayerVehicleID(playerid); format(str, sizeof(str), "Fuel: ~r~%i~n~~w~Engine: %s", vInfo[vehicleid][vCombustivel], vInfo[vehicleid][vTemMotor] ? ("~g~Yes") : ("~r~None")); PlayerTextDrawSetString(playerid, VEH_HUD[playerid][3], str); } } } return 1; } |
public AtualizarSede() { foreach(Player, i) { if(pInfo[i][pConectado] == true && IsPlayerConnected(i) && !IsPlayerNPC(i)) { if(pInfo[i][pSede] > 0) pInfo[i][pSede]--; if(pInfo[i][pSede] == 5) SendClientMessage(i, COR_AMARELO, Translate(pInfo[i][pIdioma], "[Sede]: Voce esta ficando com Sede, beba alguma coisa ou comecara a perder vida.", "[THIRST]: You're getting thirsty, drink something or will begin to lose health.")); if(pInfo[i][pSede] == 0) { new Float:health; GetPlayerHealth(i, health), SetPlayerHealth(i, health-10); SetPlayerDrunkLevel(i, 4500); } } } return 1; } |
stock ResetarPlayer(playerid) { ResetPlayerInventory(playerid); ResetPlayerWeapons(playerid); if(pInfo[playerid][pSangrando] == 1) KillTimer(SangueTimer[playerid]); pInfo[playerid][pChat] = 0; pInfo[playerid][pQuebrado] = 0; pInfo[playerid][pSangrando] = 0; pInfo[playerid][pBackpack] = 5; pInfo[playerid][pFome] = 80; pInfo[playerid][pSede] = 80; pInfo[playerid][pRadiation] = 0; AddItem(playerid, "Water Canteen", 1); AddItem(playerid, "Bandage", 1); return 1; } |