Bribe System - Need help! -
Slaughters - 07.11.2014
I'm looking to insert a Bribe System into my CNR script. (ZCMD)
I want the system/commands to do something like this:
Код:
#define MAX_BRIBES 200
new BribeTimer[MAX_PLAYERS];
new Bribe[MAX_BRIBES];
CMD:createbribe(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not a RCON admin.");
new Float:p[3];
GetPlayerPos(playerid, p[0], p[1], p[2]);
for(new i = 0; i < MAX_BRIBES; i++)
{
Bribe[i] = CreatePickup(1247, 1, p[0], p[1], p[2], GetPlayerVirtualWorld(playerid);
}
SendClientMessage(playerid, -1, "You created a Bribe at your Location.");
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new i = 0; i < MAX_BRIBES; i++)
{
if(pickupid == Bribe[i])
{
new Wanted = GetPlayerWantedLevel(playerid);
if(Wanted == 0) return SendClientMessage(playerid, -1, "You dont need a Bribe right now.");
if(BribeTimer[playerid] == 1) return SendClientMessage(playerid, -1, "You cant do this right now.");
SetPlayerWantedLevel(playerid, Wanted - 1);
BribeTimer[playerid] = 1;
SetTimerEx("BribeDecrease", false, 300000, "i", playerid);
}
}
return 1;
}
forward BribeDecrease(playerid);
public BribeDecrease(playerid)
{
BribeTimer[playerid] = 0;
return 1;
}
That code errors, and isn't compatible with my script.
Re: Bribe System - Need help! -
ZaBraNjeNi - 07.11.2014
Can you show errors?
Re: Bribe System - Need help! -
CoaPsyFactor - 07.11.2014
with this code
pawn Код:
for(new i = 0; i < MAX_BRIBES; i++)
{
Bribe[i] = CreatePickup(1247, 1, p[0], p[1], p[2], GetPlayerVirtualWorld(playerid);
}
you will be able to have 200 bribes, but only on one place (last place where admin created bribe)
and to make this code work change
pawn Код:
CreatePickup(1247, 1, p[0], p[1], p[2], GetPlayerVirtualWorld(playerid);
to
pawn Код:
CreatePickup(1247, 1, p[0], p[1], p[2], GetPlayerVirtualWorld(playerid));
Notice: I didn't try to compile this, but I thing there is only this error with calling create pickup function
Re: Bribe System - Need help! -
Slaughters - 07.11.2014
Thanks, it works now!
Re: Bribe System - Need help! -
CoaPsyFactor - 07.11.2014
I'm glad I helped
and you should change this
for in command, as it will - as I already said - create each time 200 bribes but all of them will be at same position, you should initialize all of 'em with -1, and then in
for loop check if is equal to -1 create it and break the loop