PDA

View Full Version : Score Error


PowerF
05/07/2014, 03:55 AM
Please Help Me

when am kill my friend,i get 2 score
and when am kill again i dont get 2 score

public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
new str[128];
PlayerAcc[killerid][Kills]++;
PlayerAcc[playerid][Deaths]++;
GivePlayerMoney(killerid,4000);
SetPlayerScore(killerid,GetPlayerScore(playerid)+w ww2); // change xx to score
StopAudioStreamForPlayer(playerid);
if(IsBeingSpeced[playerid] == 1)
{
foreach(Player, i)
{
if(spectatorid[i] == playerid)
{
KillTimer(SpecTimer[i]);
StopSpectate(i);
format(str, sizeof(str), "Your spectating to %s(%d) has been ended (Reason: Player Death)", GetName(playerid), playerid);
SendClientMessage(i, COLOR_RED, str);
}
}
}
if(gPlayerUsingLoopingAnim[playerid])
{
gPlayerUsingLoopingAnim[playerid] = 0;
TextDrawHideForPlayer(playerid, txtAnimHelper);
}
if(PlayerAcc[playerid][pDuty] == 1)
{
GameTextForPlayer(playerid, "~w~Admin Duty ~r~Ended!", 4000, 3);
SendClientMessage(playerid, COLOR_RED, "Your Admin Duty has been ended, You die!");
PlayerAcc[playerid][pDuty] = 0;
KillTimer(HealthTimer[playerid]);
SetPlayerColor(playerid, GetPVarInt(playerid, "MyColor"));
Delete3DTextLabel(Duty[playerid]);
}
if(PlayerAcc[playerid][God] == 1)
{
GameTextForPlayer(playerid, "~w~God Mode ~r~Ended!", 4000, 3);
SendClientMessage(playerid, COLOR_RED, "Your God Mode has been ended, You die!");
PlayerAcc[playerid][God] = 0;
KillTimer(HealthTimer[playerid]);
Delete3DTextLabel(GodM[playerid]);
}
if(GetPlayerMoney(playerid) >= 1)
{
GivePlayerMoney(playerid, -1);
}
else return SendClientMessage(playerid, COLOR_RED, "The Server didn't take your score, Because you don't have score");
return 1;
}

BroZeus
05/07/2014, 04:32 AM
SetPlayerScore(killerid,GetPlayerScore(playerid)+w ww2);
change this to the following
SetPlayerScore(killerid,(GetPlayerScore(playerid)+ 2));

IceBilizard
05/07/2014, 04:36 AM
sorry wrong

Threshold
05/07/2014, 05:46 AM
public OnPlayerDeath(playerid, killerid, reason)

SendDeathMessage(killerid, playerid, reason);
PlayerAcc[playerid][Deaths]++;
if(killerid != INVALID_PLAYER_ID)
{
PlayerAcc[killerid][Kills]++;
GivePlayerMoney(killerid,4000);
SetPlayerScore(killerid, GetPlayerScore(playerid) + 2); // change xx to score
}
StopAudioStreamForPlayer(playerid);
if(IsBeingSpeced[playerid])
{
new str[90];
format(str, sizeof(str), "Your spectating to %s(%d) has been ended (Reason: Player Death)", GetName(playerid), playerid);
foreach(Player, i)
{
if(spectatorid[i] == playerid)
{
KillTimer(SpecTimer[i]);
StopSpectate(i);
SendClientMessage(i, COLOR_RED, str);
}
}
}
if(gPlayerUsingLoopingAnim[playerid])
{
gPlayerUsingLoopingAnim[playerid] = 0;
TextDrawHideForPlayer(playerid, txtAnimHelper);
}
if(PlayerAcc[playerid][pDuty])
{
GameTextForPlayer(playerid, "~w~Admin Duty ~r~Ended!", 4000, 3);
SendClientMessage(playerid, COLOR_RED, "Your Admin Duty has been ended, You die!");
PlayerAcc[playerid][pDuty] = 0;
KillTimer(HealthTimer[playerid]);
SetPlayerColor(playerid, GetPVarInt(playerid, "MyColor"));
Delete3DTextLabel(Duty[playerid]);
}
if(PlayerAcc[playerid][God])
{
GameTextForPlayer(playerid, "~w~God Mode ~r~Ended!", 4000, 3);
SendClientMessage(playerid, COLOR_RED, "Your God Mode has been ended, You die!");
PlayerAcc[playerid][God] = 0;
KillTimer(HealthTimer[playerid]);
Delete3DTextLabel(GodM[playerid]);
}
if(GetPlayerMoney(playerid)) GivePlayerMoney(playerid, -1);
else SendClientMessage(playerid, COLOR_RED, "The Server didn't take your score, Because you don't have score");
return 1;
}