Jump to content

[HELP]Save weapon


GvaKO

Recommended Posts

Caute mam taketo ukladanie a su tam aj zbrane , ale neukladaju sa nefunguje to .. prosim help

 

#include <a_samp>

#include <dini>

 

new Name[MAX_PLAYER_NAME];

 

new playerDeath[MAX_PLAYERS];

 

//new file[128];

new Float:x, Float:y, Float:z;

 

new File[64];

//new file[248];

//1653.0432,1305.3707,10.8203

public OnPlayerDisconnect(playerid)

{

GetPlayerName(playerid, Name, sizeof Name);

format(File, sizeof(File), "%s.ini",Name);

 

if(!dini_Exists(File))

{

 

}

else

{

dini_IntSet(File, "Farba", GetPlayerColor(playerid));

dini_IntSet(File, "Skin", GetPlayerSkin(playerid));//GetPlayerColor(playerid)

GetPlayerPos(playerid, x, y, z);

dini_FloatSet(File, "posX", x);

dini_FloatSet(File, "posY", y);

dini_FloatSet(File, "posZ", z);

 

new weapons[13][2];

new string[32];

for (new i = 0; i < 13; i++)

{

GetPlayerWeaponData(playerid, i, weapons[0], weapons[1]);

format(string, sizeof string, "zbran%d", i);

dini_IntSet(File, string, weapons[0]);

format(string, sizeof string, "munice%d", i);

dini_IntSet(File, string, weapons[1]);

}

 

 

}

}

/*

SetPlayerColor(playerid, 0x808080AA);

SetPlayerPos(playerid, 1653.0432,1305.3707,10.8203);

*/

public OnPlayerConnect(playerid)

{

//new posZ[MAX_PLAYERS];

GetPlayerName(playerid, Name, sizeof(Name));

format(File, sizeof(File), "%s.ini",Name);

if(!dini_Exists(File))

{

dini_Create(File);

//dini_IntSet(File, "Farba",SetPlayerColor(playerid) = 0x808080AA);//0x808080AA

dini_IntSet(File, "Skin",0);

//posZ[playerid] += 100;

 

dini_IntSet(File, "Farba", 0x808080AA);

/*x = dini_Float(File, "posX");

y = dini_Float(File, "posY");

z = dini_Float(File, "posZ");

*/

dini_IntSet(File, "posX",1651);

dini_IntSet(File, "posY",1307);

dini_IntSet(File, "posZ",12);

 

//dini_IntSet(File, "posZ",posZ[playerid] += 100);

 

//dini_IntSet(File, "posZ",posZ += 3);

 

//dini_IntSet(file,"Moneys",PlayerInfo[playerid][Moneys] += 30000);

 

 

}

else

{

//posZ[playerid] += 100;

//dini_IntSet(File, "posZ",posZ[playerid] += 10);

//SetPlayerColor(playerid, 0x808080AA);

// SetPlayerPos(playerid, 1653.0432,1305.3707,10.8203);

}

return 1;

}

 

public OnPlayerDeath(playerid, killerid, reason)

{

playerDeath[playerid] = 1; // This is saying that the player died.

 

GetPlayerName(playerid, Name, sizeof Name);

format(File, sizeof(File), "%s.ini",Name);

if(!dini_Exists(File))

{

}

else

{

dini_IntSet(File, "Skin", GetPlayerSkin(playerid));

dini_IntSet(File, "Farba", GetPlayerColor(playerid));

 

}

 

 

}

 

public OnPlayerSpawn(playerid)

{

GetPlayerName(playerid, Name, sizeof(Name));

format(File, sizeof(File), "%s.ini",Name);

if(dini_Exists(File))

{

 

 

 

new skin = dini_Int(File, "Skin");

new farba = dini_Int(File, "Farba");

new x = dini_Int(File, "posX");

new y = dini_Int(File, "posY");

new z = dini_Int(File, "posZ");

 

SetPlayerSkin(playerid, skin);

SetPlayerColor(playerid, farba);

 

//x = dini_Float(file, "posX");

//y = dini_Float(file, "posY");

 

SetPlayerPos(playerid, x, y, z);

 

new weapons[13][2];

new string[32];

for (new i = 0; i < 13; i++)

{

format(string, sizeof string, "zbran%d", i);

weapons[0] = dini_Int(File, string);

format(string, sizeof string, "munice%d", i);

weapons[1] = dini_Int(File, string);

SetPlayerAmmo(playerid, weapons[0], weapons[1]);

}

 

}

 

if(playerDeath[playerid] == 1) // This is checking if the player had died previously

{

SetPlayerPos(playerid,1607.4254,1841.4788,10.8203); // Replace X, Y, and Z With the Hospital Co-ords.

playerDeath[playerid] = 0; // This is saying the player is not dead.

 

}

return 1;

}

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...