[FilterScript] Dynamic Bribe System [Mysql R39-3]
#1

Commands :
/createbribe - this creates a bribe star pickup with a text label at your position example: [Bribe x] X represents the id.
/removebribe [id] - this removed the created bribe using the ID.

Info :
I've been pretty bad at pawn, and I was looking for a script like this pretty long, however, i was never able to find one that would do something as basic as this, which works with MySQL.
Why did I choose MySQL? Well, Mysql is simple and works fast.
all it does is making a bribe star wich decreases the wantedlevel by 2, once useable each 2 minutes.(per star)
I'm sharing this code for all the people that want the same thing as me.
Self-Explanatory code, very basic but working as it should.
I've used the following plugins to make this filterscript;
Mysql R39-3
Zcmd
streamer
YSI\Y_iterate
SScanf2

I wanted to post some screenshots or a video, however, its very easy to use so I would say give it a test.


Link : http://pastebin.com/rXM3HDNK
Reply
#2

Good, but what if we have server sided wanted level?
Reply
#3

Good , I think Good FileterScript
Reply
#4

Good job.
Reply
#5

Basically here's the 'important' code in the filterscript:
pawn Code:
hook OnPlayerPickUpPickup(playerid, pickupid)
{
    new id;
    if((gettime() - DelayTick[playerid]) < BRIBE_USE) return 1;
    if(pickupid == BribeData[id][brid])
    {
    DelayTick[playerid] = gettime();
    SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) -2);
    SendClientMessage(playerid, 0xFFFFFFAA, "{ABD182}[Notice]:{FAFAFA} Your wanted level has decreased by 2 since your picked up a bribe star!");
    return 1;
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by Luicy.
View Post
Basically here's the 'important' code in the filterscript:
pawn Code:
hook OnPlayerPickUpPickup(playerid, pickupid)
{
    new id;
    if((gettime() - DelayTick[playerid]) < BRIBE_USE) return 1;
    if(pickupid == BribeData[id][brid])
    {
    DelayTick[playerid] = gettime();
    SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) -2);
    SendClientMessage(playerid, 0xFFFFFFAA, "{ABD182}[Notice]:{FAFAFA} Your wanted level has decreased by 2 since your picked up a bribe star!");
    return 1;
    }
    return 1;
}
But there's no loop, so it only works for the first pickup.

"Your wanted level has decreased by 2 since your picked up a bribe star!"

Good job :/
Reply
#7

I appreciate all of your input, yes it may have some typo's or I forgot to loop trough, I was a bit tired.
But thank you really all of your input helps me get further.

next time, instead of giving comments in a negative way, try giving it in a positive one.
Reply
#8

They are not negative comments but these things need to be fixed so it will work properly.

There is another one which is very important: Dynamic pickups are created but OnPlayerPickUpPickup is used instead of OnPlayerPickUpDynamicPickup callback. Why do you use "hook" keyword as it is not an include?
Reply
#9

Quote:
Originally Posted by Konstantinos
View Post
They are not negative comments but these things need to be fixed so it will work properly.

There is another one which is very important: Dynamic pickups are created but OnPlayerPickUpPickup is used instead of OnPlayerPickUpDynamicPickup callback. Why do you use "hook" keyword as it is not an include?
This is a useful comment i can do something with this lmao, i didn't use it as a filterscript for my gamemode but i was hooking it to my main script as i programmed it partly modular, utils are separated from the main, let me fix these errors.
Reply
#10

Quote:
Originally Posted by yvoms
View Post
This is a useful comment i can do something with this lmao, i didn't use it as a filterscript for my gamemode but i was hooking it to my main script as i programmed it partly modular, utils are separated from the main, let me fix these errors.
Still, you are not supposed to use hooks on Filterscripts and even if you copied it from your code you need to modify it before releasing it here.

Also you are not checking if player is wanted or not, for ex. if player's wanted level is 0 you decrease it by 2 so player's level is now -2.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)