15.08.2013, 02:45
How to code a dynamic looting system I know the basics and that I need to make objects pos and so on but uow to make the inv system
#include <a_samp>
#include <zcmd>
new BRobbery[MAX_PLAYERS];
new string[128];
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFF4000FF
public OnPlayerConnect(playerid)
{
BRobbery[playerid] = 0;
return 1;
}
CMD:robbank(playerid,params[])
{
new pName[MAX_PLAYER_NAME];
for(new i = 0; i<MAX_PLAYERS; i++)
{
BRobbery[i] = 1;
}
format(string,sizeof(string),"[BREAKING NEWS]%s has started robbing bank!",GetPlayerName(playerid,pName,sizeof(pName)));
SendClientMessage(playerid,COLOR_RED,string);
}
CMD:loot(playerid,params[])
{
new LootMax;
if(LootMax == 10) return SendClientMessage(playerid,COLOR_WHITE,"Enough robbery mate!");
if(!IsPlayerInRangeOfPoint(playerid,5,0.0,0.0,0.0)) return SendClientMessage(playerid,COLOR_RED,"You're not in the vault!");
if(BRobbery[playerid] != 1) return SendClientMessage(playerid,COLOR_WHITE,"The bank robbery isn't started yet!");
new money = random(1000);
format(string,sizeof(string),"Your loot bought up $%d in your bag!",money);
SendClientMessage(playerid,COLOR_YELLOW,string);
LootMax++;
return 1;
}