How to add Moneybag? -
Johnny Jojy - 10.11.2012
Guys,I need a help with scripting..
If something is dropped on the floor (eg-Money Bag)
and when a player pass through it.That money bag should be attached to that player and that player should get 200$ per 2 seconds..How?
What is the script for that??
Re: How to add Moneybag? -
Lordzy - 10.11.2012
You could create a pickup of it using CreatePickup and then call it under OnPlayerPickupPickup callback.
Here's an example,
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new briefcase;
new Float:xpos,Float:ypos,Float:zpos;
GetPlayerPos(playerid, xpos, ypos, zpos);
new vworld[MAX_PLAYERS];
vworld[playerid] = GetPlayerVirtualWorld(playerid);
briefcase = CreatePickup(1210, 2, xpos, ypos, zpos, vworld[playerid]); //Creates the briefcase when player dies, on his position.
return 1;
}
public OnPlayerPickupPickup(playerid, pickupid)
{
if(pickupid == briefcase) //When picking a briefcase.
{
GivePlayerMoney(playerid, 500); //Gives money.
SetPlayerAttachedObject(playerid, 3, 1210, 6); //Attach's the briefcase.
DestroyPickup(briefcase);
}
return 1;
}
Re: How to add Moneybag? -
Johnny Jojy - 10.11.2012
Thanks,But am new in scripting..So can you tell me where to add them :-/
Re: How to add Moneybag? -
[HK]Ryder[AN] - 10.11.2012
use this code
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new briefcase;
new Float:xpos,Float:ypos,Float:zpos;
GetPlayerPos(playerid, xpos, ypos, zpos);
new vworld[MAX_PLAYERS];
vworld[playerid] = GetPlayerVirtualWorld(playerid);
briefcase = CreatePickup(1210, 2, xpos, ypos, zpos, vworld[playerid]); //Creates the briefcase when player dies, on his position.
return 1;
}
public OnPlayerPickupPickup(playerid, pickupid)
{
if(pickupid == briefcase) //When picking a briefcase.
{
SetTimerEx("givemoney", 2000, true, "i", playerid);
SetPlayerAttachedObject(playerid, 3, 1210, 6); //Attach's the briefcase.
DestroyPickup(briefcase);
}
return 1;
}
forward givemoney(playerid);
public givemoney(playerid)
{
GivePlayerMoney(playerid, 200);
return 1;
}
Re: How to add Moneybag? -
Lordzy - 10.11.2012
Oh I didn't see that I must give 200 always :/. Thanks Ryder for posting it and Johnny you can add it as a filterscript.
Here's it, and I've embedded it a bit in adding a command and some other.
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#define FILTERSCRIPT
#define red 0xFF0000FF
#define green 0xFF0000
new Lbrief[MAX_PLAYERS];
CMD:givebriefcase(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, red, "You must login as RCON admin to use this command.");
new p2, str[128], Lname[MAX_PLAYER_NAME];
if(sscanf(params,"u",p2)) return SendClientMessage(playerid, red, "Usage: /givebriefcase [playerid]");
Lbrief[p2] = 1;
GetPlayerName(playerid, Lname, sizeof(Lname));
format(str, sizeof(str), "You have recieved a briefcase from %s", Lname);
SendClientMessage(p2, green, str);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(Lbrief[playerid] == 1)
{
new briefcase;
new Float:xpos,Float:ypos,Float:zpos;
GetPlayerPos(playerid, xpos, ypos, zpos);
new vworld[MAX_PLAYERS];
vworld[playerid] = GetPlayerVirtualWorld(playerid);
briefcase = CreatePickup(1210, 2, xpos, ypos, zpos, vworld[playerid]); //Creates the briefcase when player dies, on his position.
Lbrief[playerid] = 0;
}
return 1;
}
public OnPlayerPickupPickup(playerid, pickupid)
{
if(pickupid == briefcase) //When picking a briefcase.
{
SetPlayerAttachedObject(playerid, 3, 1210, 6); //Attach's the briefcase.
DestroyPickup(briefcase);
Lbrief[playerid] = 1;
}
return 1;
}
public OnPlayerUpdate(playerid)
{
if(Lbrief[playerid] == 1)
{
SetTimerEx("givemoney", 2000, true, "i", playerid);
}
return 1;
}
forward givemoney(playerid);
public givemoney(playerid)
{
GivePlayerMoney(playerid, 200);
return 1;
}
Use /givebriefcase to give briefcase to a player.
Just compile this and check for errors/warns, if you have, please PM me or post here. If no errors/warns, add this as a filterscript and it will work.
Note:You must login as RCON to use /givebreifcase and must have zcmd include and sscanf2 include+plugin.
Re: How to add Moneybag? -
Johnny Jojy - 10.11.2012
They are showing "cannot read from file: "zcmd" am not having zcmd file..What to do??
Re: How to add Moneybag? -
Johnny Jojy - 10.11.2012
I was not having file "zcmd" and "sscanf2" I downloaded it and added.Now its showing--
C:\Users\admin\Desktop\License To Kill\filterscripts\Money Bag.txt(39) : error 017: undefined symbol "briefcase"
C:\Users\admin\Desktop\License To Kill\filterscripts\Money Bag.txt(42) : error 017: undefined symbol "briefcase"
Re: How to add Moneybag? -
Johnny Jojy - 10.11.2012
Please help me......
Re: How to add Moneybag? -
Lordzy - 10.11.2012
At the top, add this
Re: How to add Moneybag? -
Johnny Jojy - 10.11.2012
oh,ok and I need a bomb planting/diffusion script.Can I have one..
I need is - when its planting time terrorist team show have a red marker in mad and when its time to defuse army team should defuse it..