[FilterScript] XP Experience System [Picture added]
#1

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;
}
Reply
#2

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) ...)
Reply
#3

thanks i fixed it
Reply
#4

nice one mate i like ur job thanks
Reply
#5

Looks great kitty
Reply
#6

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.
Reply
#7

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

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
Reply
#9

Where's the picture? XD
Reply
#10

its on the top cant u see it o,o?
Reply
#11

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

nice one dude good job keep it up
Reply
#13

Quote:

Heres another way to do it.

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

thanks ill use that in my next verison of this!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)