Sziasztok!!!
Raktam a szerveremre egy új bankrendszert,ámde a következõ probléma lépett fel..
Nos az a problem hogy ha berakok a bankba pénzt a bankszámlára rárakja az összeget.de le nem vonja a játékostol,kivételnél ugyanez,kiveszek a bankból összeget levonja a számláról,de a playerhez nem csatolja hozzá.
Aki tudna segíteni annak megköszönném,nagyon sûrgõs!!!
bankrendszer linkje:http://forum.sa-mp.com/showthread.php?t=306557
Itt a bank:
////////////////////////////////////////////
/////// Fas Bank System By FaSihYouSf////////
////////////////////////////////////////////
#include <a_samp>
#include <dini>
#include <dudb>
#include <cpstream>
new BankCP;
new BankDor;
new BankExit;
new BankJoin;
new str[256];
new Interior[MAX_PLAYERS];
new BankMoney[MAX_PLAYERS];
new Float:Pos[MAX_PLAYERS][4];
public OnFilterScriptInit()
{
BankCP = CPS_AddCheckpoint(2144.1709,1639.9510,993.5761,2.5,50);
BankDor = CreateObject(2634,2144.19,1627.1,994.257,0.0,0.0,180);
BankJoin = CreatePickup(1318, 23, -179.1868,1133.1166,19.7422);
BankExit = CreatePickup(1559,23,2144.1033,1628.6090,993.5761);
printf(\"Bank System By FasihYouSf is == ON\",0);
return true;
}
public OnFilterScriptExit()
{
DestroyObject(BankDor);
DestroyPickup(BankExit);
CPS_RemoveCheckpoint(BankCP);
printf(\"Bank System By FaSihYouSf is == OFF\",0);
return true;
}
public OnPlayerConnect(playerid)
{
if(!dini_Exists(GetBankFile(playerid)))
{
dini_Create(GetBankFile(playerid));
dini_IntSet(GetBankFile(playerid),\"Money\",0);
BankMoney[playerid] = 0;
}
else BankMoney[playerid] = dini_Int(GetBankFile(playerid),\"Money\");
return true;
}
public OnPlayerDisconnect(playerid, reason)
{
if(dini_Exists(GetBankFile(playerid))) dini_IntSet(GetBankFile(playerid),\"Money\",BankMoney[playerid]);
return true;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256],tmp[256],idx;
cmd = strtok(cmdtext,idx);
if(strcmp(cmd,\"/betesz\",true) == 0)
{
if(!CPS_IsPlayerInCheckpoint(playerid,BankCP)) return SendClientMessage(playerid,0xFF0000AA,\"Te nem vagy a bankban!\");
tmp = strtok(cmdtext,idx);
if(!strlen(tmp) || !IsNumeric(tmp)) return SendClientMessage(playerid,0xFF0000AA,\"Használat: /betesz [összeg]\");
new Money = strval(tmp);
if(GetPlayerMoney(playerid) < Money || Money < 1) return SendClientMessage(playerid,0xFF0000AA,\"Érvénytelen összeg\");
format(str,sizeof(str),\"Sikeresen betettél a bankba %d$-t!\",Money);
SendClientMessage(playerid,0xFFFF00AA,str);
GivePlayerMoney(playerid,-Money);
BankMoney[playerid] += Money;
return true;
}
if(strcmp(cmd,\"/kivesz\",true) == 0)
{
if(!CPS_IsPlayerInCheckpoint(playerid,BankCP)) return SendClientMessage(playerid,0xFF0000AA,\"Te nem vagy a bankban!\");
tmp = strtok(cmdtext,idx);
if(!strlen(tmp) || !IsNumeric(tmp)) return SendClientMessage(playerid,0xFF0000AA,\"Használat: /kivesz [összeg]\");
new Money = strval(tmp);
if(Money < 1) return SendClientMessage(playerid,0xFF0000AA,\"Érvénytelen összeg\");
if(Money > BankMoney[playerid]) return SendClientMessage(playerid,0xFF0000AA,\"Érvénytelen összeg\");
format(str,sizeof(str),\"Sikeresen kivettél a bankból %d$-t!\",Money);
SendClientMessage(playerid,0xFFFF00AA,str);
GivePlayerMoney(playerid, Money);
BankMoney[playerid] -= Money;
return true;
}
if(strcmp(cmdtext,\"/szamla\",true) == 0)
{
if(!CPS_IsPlayerInCheckpoint(playerid,BankCP)) return SendClientMessage(playerid,0xFF0000AA,\"Te nem vagy bankban!\");
format(str,sizeof(str),\"Számládon lávõ összeg: %d$\",BankMoney[playerid]);
SendClientMessage(playerid,0xFFFF00AA,str);
return true;
}
return false;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(CPS_IsPlayerInCheckpoint(playerid,BankCP))
{
SendClientMessage(playerid,0xd69846AA,\"/betesz\");
SendClientMessage(playerid,0xd69846AA,\"/kivesz\");
SendClientMessage(playerid,0xd69846AA,\"/szamla\");
}
return true;
}
public OnPlayerPickUpPickup(playerid,pickupid)
{
if(pickupid == BankExit)
{
GameTextForPlayer(playerid,\"~w~Fort Carson Falu\",1000,1);
SetPlayerPos(playerid,-181.2346,1132.8027,19.7422);
PlayerPlaySound(playerid,1063,0.0,0.0,0.0);
SetPlayerFacingAngle(playerid,276.9745);
SetPlayerInterior(playerid,Interior[playerid]);
SetCameraBehindPlayer(playerid);
return true;
}
if(pickupid == BankJoin)
{
Interior[playerid] = GetPlayerInterior(playerid);
GetPlayerFacingAngle(playerid,Pos[playerid][3]);
GetPlayerPos(playerid,Pos[playerid][0],Pos[playerid][1],Pos[playerid][2]);
PlayerPlaySound(playerid,1063,0.0,0.0,0.0);
GameTextForPlayer(playerid,\"~w~bank\",1000,1);
SetPlayerPos(playerid,2144.2148,1630.1636,993.5761);
SetPlayerFacingAngle(playerid,357.1255);
SetPlayerVirtualWorld(playerid,0);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid,1);
return true;
}
return true;
}
stock IsNumeric(string[])
{
for(new i = 0; i < strlen(string); i++) if(string > \'9\' || string < \'0\') return false;
return true;
}
stock GetBankFile(playerid)
{
new file[50];
format(file,sizeof(file),\"Bank/%s.txt\",GetName(playerid));
return file;
}
stock GetName(playerid)
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
return PlayerName;
}