SA-MP Forums Archive
[FilterScript] XP Experience System [Picture added] - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] XP Experience System [Picture added] (/showthread.php?tid=177743)



XP Experience System [v1.1 Updated] - Kitten - 19.09.2010

XP Experience System by Kitten v1.0

>>>>>> This is a XP Experience Which when u kill a person u see the textdraw on right top goes 1/50
>>>>>> This is a short simple script and easy to edit
>>>>>> You can edit this till u just keep me as the creator credit
>>>>>> Have fun
>>>>>>

>>>>>> Download
v1.0
http://pastebin.com/xQu5RSSJ
v1.1
http://pastebin.com/NeLkQJyD

or

pawn Code:
//////////////////////////////////////////////////
/////////////XP Experience FS By Kitten///////////
/////////////Easy To Edit////////////////////////
/////////////////////////////////////////////////

#include <a_samp>
#define COLOR_GREEN 0x20B2AAAA
new Text:XP[MAX_PLAYERS];

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" XP Experience FS by kitten");
    print("--------------------------------------\n");
   
   
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
        XP[playerid] = TextDrawCreate(545.000000, 23.000000, "XP: 0/50");
        TextDrawBackgroundColor(XP[playerid], 255);
        TextDrawFont(XP[playerid], 1);
        TextDrawLetterSize(XP[playerid], 0.400000, 1.700000);
        TextDrawColor(XP[playerid], -1);
        TextDrawSetOutline(XP[playerid], 0);
        TextDrawSetProportional(XP[playerid], 1);
        TextDrawSetShadow(XP[playerid], 1);
    }
   
    return 1;
}

public OnFilterScriptExit()
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
        TextDrawHideForAll(XP[playerid]);
        TextDrawDestroy(XP[playerid]);
    }
    return 1;
}
public OnPlayerSpawn(playerid)
{
     TextDrawShowForPlayer(playerid,XP[playerid]);
     return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{

    new msg[64];
    new score = GetPlayerScore(killerid);
    SetPlayerScore(killerid, score+1);
    format(msg, sizeof(msg),"XP: %d/50",score+1);
    TextDrawSetString(XP[killerid],msg);
    GivePlayerMoney(killerid, 12000);
    GameTextForPlayer(killerid, "~p~1+ ~w~XP Experience! ~n~~g~+$12000!!",6000,4);
   
    if(GetPlayerScore(killerid) == 10)
    {
        GivePlayerWeapon(killerid,31,1000);
        GameTextForPlayer(killerid,"~r~ XP AWARDS ~n~ ~w~ M4 Unlocked",6000,3);
        new name[MAX_PLAYER_NAME], string[100];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "Player * %s Has Been XP Awared 10 Kills ** m4 unlocked for him", name);
        SendClientMessageToAll(COLOR_GREEN, string);
    }
    if(GetPlayerScore(killerid) == 20)
    {
        GivePlayerWeapon(killerid,30,1000);
        GameTextForPlayer(killerid,"~r~ XP AWARDS ~n~ ~w~ AK47 Unlocked",6000,3);
        new name[MAX_PLAYER_NAME], string[100];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "Player * %s Has Been XP Awared 20 Kills ** ak47 unlocked for him", name);
        SendClientMessageToAll(COLOR_GREEN, string);
    }
    if(GetPlayerScore(killerid) == 30)
    {
        GivePlayerWeapon(killerid,27,1000);
        GameTextForPlayer(killerid,"~r~ XP AWARDS ~n~ ~w~ Combat Shotgun Unlocked",6000,3);
        new name[MAX_PLAYER_NAME], string[100];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "Player * %s Has Been XP Awared 30 Kills ** Combat Shotgun unlocked for him", name);
        SendClientMessageToAll(COLOR_GREEN, string);
    }
    if(GetPlayerScore(killerid) == 40)
    {
        GivePlayerWeapon(killerid,24,1000);
        GameTextForPlayer(killerid,"~r~ XP AWARDS ~n~ ~w~ Desert Eagle Unlocked",6000,3);
        new name[MAX_PLAYER_NAME], string[100];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "Player * %s Has Been XP Awared 40 Kills ** Desert Eagle unlocked for him", name);
        SendClientMessageToAll(COLOR_GREEN, string);
    }
    if(GetPlayerScore(killerid) == 50)
    {
        GivePlayerWeapon(killerid,32,1000);
        GameTextForPlayer(killerid,"~r~ XP AWARDS ~n~ ~w~ Tec 9 Unlocked",6000,3);
        new name[MAX_PLAYER_NAME], string[100];
        new name2[MAX_PLAYER_NAME], string2[100];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "Player * %s Has Been XP Awared 50 Kills ** Tec 9 unlocked for him", name);
        format(string2, sizeof(string2), "~y~ Player %s Has Finshed XP Experience 50 kills",name2);
        GameTextForAll(string2,6000,3);
        SendClientMessageToAll(COLOR_GREEN, string);
    }
    return 1;
}



Re: XP Experience System - Sniperwolves - 19.09.2010

well done
just one small mistake: on onplayerdeath you check the score of the dead person (playerid)
you have to change playerid with killerid ( if(GetPlayerScore(playerid) > 10) ...)


Re: XP Experience System [Picture added] - Kitten - 19.09.2010

thanks i fixed it


Re: XP Experience System [Picture added] - royal_king - 19.09.2010

nice one mate i like ur job thanks


Re: XP Experience System [Picture added] - willsuckformoney - 19.09.2010

Looks great kitty


Re: XP Experience System [Picture added] - Hiddos - 19.09.2010

Another li'l mistake:

pawn Code:
if(GetPlayerScore(killerid) > 10)
This means that everytime that the score of the killerid is MORE THEN 10, he gets those messages.

pawn Code:
if(GetPlayerScore(killerid) == 10)
Would be better. He can only get his reward once then .

Last question: Don't you need to show the textdraws as well? I don't see any TextDrawShowForPlayer code lol.


Re: XP Experience System [Picture added] - Basicz - 19.09.2010

Nice filterscript Kitten!
How long you take for making it?


Re: XP Experience System [Picture added] - Kitten - 19.09.2010

Quote:

Last question: Don't you need to show the textdraws as well? I don't see any TextDrawShowForPlayer code lol.

forgot to add i added it now

Quote:

Nice filterscript Kitten!
How long you take for making it?

not much around 10- 2 min


Respuesta: XP Experience System [Picture added] - MrDeath537 - 19.09.2010

Where's the picture? XD


Re: XP Experience System [Picture added] - Kitten - 19.09.2010

its on the top cant u see it o,o?


Re: XP Experience System [Picture added] - Retardedwolf - 19.09.2010

Heres another way to do it.
pawn Code:
new new_rank = (GetPlayerScore(killerid) / 10) + 1;
https://sampforum.blast.hk/showthread.php?tid=171124


Re: XP Experience System [Picture added] - royal_king - 19.09.2010

nice one dude good job keep it up


Re: XP Experience System [Picture added] - Kitten - 19.09.2010

Quote:

Heres another way to do it.

new new_rank = (GetPlayerScore(killerid) / 10) + 1;

thanks ill use that in my next verison of this!