-1000 when dying, can't go below 1000, why does this not work? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: -1000 when dying, can't go below 1000, why does this not work? (
/showthread.php?tid=494949)
-1000 when dying, can't go below 1000, why does this not work? -
AnthonyTimmers - 15.02.2014
Код:
public OnPlayerSpawn(playerid)
{
if (CheckDeathOnGodMode[playerid] == 1)
{
SetPlayerPos(playerid, xGodmode, yGodmode, zGodmode);
CheckDeathOnGodMode[playerid] = 0;
}
/*if (IsLoggedIn[playerid] == 0)
{
ForceClassSelection(playerid);
TogglePlayerSpectating(playerid, true);
TogglePlayerSpectating(playerid, false);
}*/
else
{
SetPlayerInterior(playerid,0);
for(new i=0; i < sizeof(ZoneInfo); i++)
{
GangZoneShowForPlayer(playerid, ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam]));
}
SetPlayerToTeamColor(playerid);
if (PlayerInfo[playerid][pCash] < 1000)
{
PlayerInfo[playerid][pCash] = 1000;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
}
else
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
}
}
return 1;
}
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if (GodMode[playerid] == 1)
{
GetPlayerPos(playerid, xGodmode, yGodmode, zGodmode);
//SetTimerEx("GodmodeDelay", 2750, false, "i", playerid);
CheckDeathOnGodMode[playerid] = 1;
}
else
{
PlayerInfo[killerid][pKills]++;
PlayerInfo[killerid][pCash] = (PlayerInfo[killerid][pCash] + 1000);
GivePlayerMoney(killerid, 1000);
PlayerInfo[playerid][pDeaths]++;
if (PlayerInfo[playerid][pCash] < 2000)
{
PlayerInfo[playerid][pCash] = 1000;
}
else
{
PlayerInfo[playerid][pCash] = (PlayerInfo[playerid][pCash] - 1000);
}
}
return 1;
}
Why does this not work?
If the player dies with 5000, he spawns with 5000, whilst it's supposed to go down to 4000... Not sure what I did wrong?
Re: -1000 when dying, can't go below 1000, why does this not work? -
AnthonyTimmers - 15.02.2014
Just noticed it's not updating the playerdeaths in the ini file either
Код HTML:
public OnPlayerDisconnect(playerid, reason)
{
if (IsHidden[playerid] == 1)
{
PlayerInfo[playerid][pAdmin] = PlayerInfo[playerid][pAdmin] - 10;
IsHidden[playerid] = 0;
}
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
AdminDuty[playerid] = 0;
IsLoggedIn[playerid] = 0;
return 1;
}
EDIT: When I check the INI file it keeps being set to 5..
Re: -1000 when dying, can't go below 1000, why does this not work? -
AnthonyTimmers - 15.02.2014
Fixed the ini file not getting the right amount of pCash, however when the player dies it still isn't being lowered by 1000.
Deaths aren't recorded either..
Re: -1000 when dying, can't go below 1000, why does this not work? -
AnthonyTimmers - 15.02.2014
Fixed it!