SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 19/10/2016, 01:16 AM   #1
yvoms
Huge Clucker
 
yvoms's Avatar
 
Join Date: Nov 2009
Location: Las Venturas
Posts: 454
Reputation: 26
Thumbs up Dynamic Bribe System [Mysql R39-3]

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
__________________

yvoms is offline   Reply With Quote
Old 19/10/2016, 06:11 AM   #2
X337
Gangsta
 
Join Date: Sep 2014
Location: Indonesia
Posts: 872
Reputation: 291
Default Re: Dynamic Bribe System [Mysql R39-3]

Good, but what if we have server sided wanted level?
__________________
viva la sa-mp
X337 is offline   Reply With Quote
Old 19/10/2016, 06:29 AM   #3
TooroKun
Little Clucker
 
TooroKun's Avatar
 
Join Date: Jul 2016
Posts: 5
Reputation: 0
Default Re: Dynamic Bribe System [Mysql R39-3]

Good , I think Good FileterScript
TooroKun is offline   Reply With Quote
Old 19/10/2016, 09:36 AM   #4
SuperTramp
Banned
 
Join Date: Aug 2016
Location: Philippines
Posts: 63
Reputation: 20
Default Re: Dynamic Bribe System [Mysql R39-3]

Good job.
SuperTramp is offline   Reply With Quote
Old 19/10/2016, 10:30 AM   #5
Luicy.
Banned
 
Join Date: Dec 2014
Location: Sweden, Skövde
Posts: 775
Reputation: 79
Default Re: Dynamic Bribe System [Mysql R39-3]

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;
}
Luicy. is offline   Reply With Quote
Old 19/10/2016, 10:47 AM   #6
SickAttack
High-roller
 
Join Date: Dec 2013
Posts: 4,761
Reputation: 754
Default Re: Dynamic Bribe System [Mysql R39-3]

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 :/
SickAttack is offline   Reply With Quote
Old 19/10/2016, 11:10 AM   #7
yvoms
Huge Clucker
 
yvoms's Avatar
 
Join Date: Nov 2009
Location: Las Venturas
Posts: 454
Reputation: 26
Default Re: Dynamic Bribe System [Mysql R39-3]

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.
__________________

yvoms is offline   Reply With Quote
Old 19/10/2016, 11:11 AM   #8
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,828
Reputation: 1401
Default Re: Dynamic Bribe System [Mysql R39-3]

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?
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 19/10/2016, 11:45 AM   #9
yvoms
Huge Clucker
 
yvoms's Avatar
 
Join Date: Nov 2009
Location: Las Venturas
Posts: 454
Reputation: 26
Default Re: Dynamic Bribe System [Mysql R39-3]

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.
__________________

yvoms is offline   Reply With Quote
Old 20/10/2016, 06:14 PM   #10
SecretBoss
Gangsta
 
SecretBoss's Avatar
 
Join Date: Dec 2014
Location: Greece
Posts: 807
Reputation: 106
Default Re: Dynamic Bribe System [Mysql R39-3]

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.
__________________
SecretBoss is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Bribe Pickup System Fairuz Filterscripts 3 29/07/2016 06:36 PM
[FilterScript] Dynamic Entrance System![MYSQL] Raimis_R Filterscripts 30 19/11/2015 07:49 PM
Bribe System - Need help! Slaughters Scripting Help 4 07/11/2014 07:32 PM
[FilterScript] 3DTextLabel Dynamic System (MySQL) iRaiDeN Filterscripts 11 04/05/2014 06:32 AM
[Help] Mysql Dynamic System. tony_fitto Scripting Help 4 07/07/2012 03:10 AM


All times are GMT. The time now is 07:45 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.