SA-MP Forums Archive
Faction Deposit - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Faction Deposit (/showthread.php?tid=200095)



Faction Deposit - djaCido23 - 17.12.2010

Hi...is there any code for /fdeposit(Faction Deposit?).I have this command but when i'm in hq and write /fdeposit he says: You are not in Hq...Thanks.


Re: Faction Deposit - Kaylux - 17.12.2010

We can't just make code without even seeing how your GM works. Post the current command.


Re: Faction Deposit - djaCido23 - 17.12.2010

Ok...i have this: if(strcmp(cmd, "/fdeposit", true) == 0 || strcmp(cmd, "/fbank", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsAMember(playerid))
{
tmp = strtok(cmdtext, idx);
new x;
x = PlayerInfo[playerid][pMember] + PlayerInfo[playerid][pLeader];
if(!strlen(tmp))
{
SCM(playerid, COLOR_WHITE, "USAGE: /fdeposit [amount]");
return 1;
}
/*if(DynamicFactions[x][fSafe] <= 0)
{
SCM(playerid, COLOR_WHITE, "The leader must buy a SAFE first !");
return 1;
}*/
new cashdeposit = strval(tmp);
GetPlayerName(playerid, sendername, sizeof(sendername));
if(!strlen(tmp))
{
SCM(playerid, COLOR_WHITE, "USAGE: /fdeposit [amount]");
return 1;
}
if(PTP(5.0,playerid,DynamicFactions[x][fX],DynamicFactions[x][fY],DynamicFactions[x][fZ]))
{
if(GetPlayerMoney(playerid) >= cashdeposit)
{
GivePlayerMoney(playerid,-cashdeposit);
DynamicFactions[x][fBank]=DynamicFactions[x][fBank]+cashdeposit;
format(string, sizeof(string), "You have deposited $%d into the faction bank, new balance: %d %", cashdeposit,DynamicFactions[x][fBank]);
SCM(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "%s has just deposited %d % into the faction bank.",sendername,cashdeposit);
SCM(playerid, COLOR_WHITE, string);
SaveDynamicFactions();
return 1;
}
else
{
SCM(playerid, COLOR_WHITE, "You don't have that amount of money!");
}
}
else
{
SCM(playerid, COLOR_WHITE, "You are not at your hq!");
}
}
}
return 1;
}

And for Withdraw i thnk is this:

if(strcmp(cmd, "/fwithdraw", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pLeader] !=0)
{
tmp = strtok(cmdtext, idx);
new x;
x = PlayerInfo[playerid][pLeader];
if(!strlen(tmp))
{
SCM(playerid, COLOR_WHITE, "USAGE: /fwdasdasdas[amount]");
return 1;
}
/*if(DynamicFactions[x][fSafe] <= 0)
{
SCM(playerid, COLOR_WHITE, "The leader must buy a SAFE first !");
return 1;
}*/
new cashdeposit = strval(tmp);
GetPlayerName(playerid, sendername, sizeof(sendername));
if(!strlen(tmp))
{
SCM(playerid, COLOR_WHITE, "USAGE: /fwdasdasdas [amount]");
return 1;
}
if(PTP(5.0,playerid,DynamicFactions[x][fX],DynamicFactions[x][fY],DynamicFactions[x][fZ]))
{
if(cashdeposit <= DynamicFactions[x][fBank])
{
GivePlayerMoney(playerid,cashdeposit);
DynamicFactions[x][fBank]=DynamicFactions[x][fBank]+cashdeposit;
format(string, sizeof(string), "You have withdrawn $%d into the faction bank, new balance: %d %", cashdeposit,DynamicFactions[x][fBank]);
SCM(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "%s has just withdrawn %d % from the faction bank.",sendername,cashdeposit);
SCM(playerid, COLOR_WHITE, string);
SaveDynamicFactions();
return 1;
}
else
{
SCM(playerid, COLOR_WHITE, "You don't have that amount of money in your faction seif!");
}
}
else
{
SCM(playerid, COLOR_WHITE, "You are not at your hq!");
}
}
}
return 1;
}


Re: Faction Deposit - Leeroy. - 17.12.2010

next time use [pawn] [ / pawn].