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.