SA-MP Forums Archive
First kill system buged - 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: First kill system buged (/showthread.php?tid=622093)



First kill system buged - henkas - 18.11.2016

So when i test first kill system i release that its have a big problems, first of all its give exp for both persons who made it first like Player1 killed Player2 they get both exp bat only Player1 should get exp. Ant other bug its doesn't matter if he killed his self like explode he still get exp for first kill like its doesn't detect if someone killing him. Sorry for me bad sentence.
Her me code
Код:
    if(killcounter == 1)
    {
	new fbname[MAX_PLAYER_NAME], fbstring[128];
	GetPlayerName(killerid, fbname, sizeof(fbname));
	format(fbstring, sizeof(fbstring),""chat""COL_WHITE" %s "COL_GREEN"has made first kill and achieve "COL_WHITE"25EXP", fbname);
    SendClientMessageToAll(0xAFAFAFAA, fbstring);
	GameTextForAll(fbstring, 2000, 3);
	GivePlayerXP(playerid,25);



Re: First kill system buged - Sew_Sumi - 18.11.2016

Seriously... You're using killerid for the message, then give XP to the player who died...


Re: First kill system buged - TwinkiDaBoss - 18.11.2016

Look at this


pawn Код:
new serverKills;
new pKills[MAX_PLAYERS];

public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID) { //making sure we have a valid killer. ie: player killed a player
        pKills[killerid] += 1; //adding 1 more kill to the killer
        if(serverKills == 0) { //if there were no kills yet
            GivePlayerXP(killerid,25); //giving XP to the killer
           
            new string[128];
            format(string,sizeof(string),"%s first blood!",GetName(killerid));
            SendClientMessageToAll(COLOR_GREEN,string);
        }
        serverKills += 1; //we are adding 1 more server kill to total kills
    }
    return 1;
}



Re: First kill system buged - henkas - 18.11.2016

Thanks fixed


Re: First kill system buged - Sew_Sumi - 18.11.2016

Quote:
Originally Posted by TwinkiDaBoss
Посмотреть сообщение
Look at this


pawn Код:
new serverKills;
new pKills[MAX_PLAYERS];

public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID) { //making sure we have a valid killer. ie: player killed a player
        pKills[killerid] += 1; //adding 1 more kill to the killer
        if(serverKills == 0) { //if there were no kills yet
            GivePlayerXP(killerid,25); //giving XP to the killer
           
            new string[128];
            format(string,sizeof(string),"%s first blood!",GetName(killerid));
            SendClientMessageToAll(COLOR_GREEN,string);
        }
        serverKills += 1; //we are adding 1 more server kill to total kills
    }
    return 1;
}
Stop handing out copy-paste code, and undermining direct learning...


Re: First kill system buged - henkas - 18.11.2016

Quote:
Originally Posted by TwinkiDaBoss
Посмотреть сообщение
Look at this


pawn Код:
new serverKills;
new pKills[MAX_PLAYERS];

public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID) { //making sure we have a valid killer. ie: player killed a player
        pKills[killerid] += 1; //adding 1 more kill to the killer
        if(serverKills == 0) { //if there were no kills yet
            GivePlayerXP(killerid,25); //giving XP to the killer
           
            new string[128];
            format(string,sizeof(string),"%s first blood!",GetName(killerid));
            SendClientMessageToAll(COLOR_GREEN,string);
        }
        serverKills += 1; //we are adding 1 more server kill to total kills
    }
    return 1;
}
Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Seriously... You're using killerid for the message, then give XP to the player who died...
Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Stop handing out copy-paste code, and undermining direct learning...
I didn't copy everything i just edit me script with this system and i saw whats wrong.


Re: First kill system buged - Sew_Sumi - 18.11.2016

That's the thing, did you even read what I had put, which was straight forward...