// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
new PlayerInfo[MAX_PLAYERS][500]
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
public OnPlayerCommandText(playerid, cmdtext[])
{
//=================[Bank System]================================================================
if(strcmp(cmdtext, "/bank", true) == 0 || strcmp(cmdtext, "/deposit", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!PlayerToPoint(20.0,playerid,2305.688964,-16.088100,26.749599))
{
SendClientMessage(playerid, 0xBEBEBEAA, " Ты не в банке !");
return 1;
}
new tmp[250];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xB4B5B7FF, "USAGE: /bank [amount]");
new string[150];
format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pBank]);
SendClientMessage(playerid, 0xB4B5B7FF, string);
return 1;
}
new cashdeposit = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xB4B5B7FF, "USAGE: /bank [amount]");
format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pBank]);
SendClientMessage(playerid, 0xB4B5B7FF, string);
return 1;
}
if (cashdeposit > GetPlayerMoney(playerid) || cashdeposit < 1)
{
SendClientMessage(playerid, 0xB4B5B7FF, " You dont have that much");
return 1;
}
GivePlayerMoney(playerid,-cashdeposit);
new curfunds = PlayerInfo[playerid][pBank];
PlayerInfo[playerid][pBank]=cashdeposit+PlayerInfo[playerid][pBank];
SendClientMessage(playerid, COLOR_WHITE, "|___ BANK STATMENT ___|");
format(string, sizeof(string), " Old Balance: $%d", curfunds);
SendClientMessage(playerid, 0xB4B5B7FF, string);
format(string, sizeof(string), " Deposit: $%d",cashdeposit);
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_GRAD6, "|-----------------------------------------|");
format(string, sizeof(string), " New Balance: $%d", PlayerInfo[playerid][pBank]);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
return 1;
}
if(strcmp(cmdtext, "/withdraw", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!PlayerToPoint(20.0,playerid,2305.688964,-16.088100,26.749599))
{
SendClientMessage(playerid, 0xBEBEBEAA, " You are not at the Bank !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xB4B5B7FF, "USAGE: /withdraw [amount]");
format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pBank]);
SendClientMessage(playerid, 0xB4B5B7FF, string);
return 1;
}
new cashdeposit = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xB4B5B7FF, "USAGE: /withdraw [amount]");
format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pBank]);
SendClientMessage(playerid, 0xB4B5B7FF, string);
return 1;
}
if (cashdeposit > PlayerInfo[playerid][pBank] || cashdeposit < 1)
{
SendClientMessage(playerid, 0xB4B5B7FF, " You dont have that much !");
return 1;
}
ConsumingMoney[playerid] = 1;
GivePlayerMoney(playerid,cashdeposit);
PlayerInfo[playerid][pBank]=PlayerInfo[playerid][pBank]-cashdeposit;
format(string, sizeof(string), " You Have Withdrawn $%d from your account Total: $%d ", cashdeposit,PlayerInfo[playerid][pBank]);
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}
return 1;
}
if(strcmp(cmdtext, "/balance", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!PlayerToPoint(20.0,playerid,2305.688964,-16.088100,26.749599))
{
SendClientMessage(playerid, 0xBEBEBEAA, " You are not at the Bank !");
return 1;
}
format(string, sizeof(string), " You Have $%d in your account.",PlayerInfo[playerid][pBank]);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
if(strcmp(cmdtext, "/transfer", true) == 0 || strcmp(cmd, "/wiretransfer", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!PlayerToPoint(20.0,playerid,2305.688964,-16.088100,26.749599))
{
SendClientMessage(playerid, 0xBEBEBEAA, " You are not at the Bank !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xB4B5B7FF, "USAGE: /transfer [playerid/PartOfName] [amount]");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xB4B5B7FF, "USAGE: /transfer [playerid/PartOfName] [amount]");
return 1;
}
moneys = strval(tmp);
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = PlayerInfo[playerid][pBank] ;
if (moneys > 0 && playermoney >= moneys)
{
PlayerInfo[playerid][pBank] -= moneys;
PlayerInfo[giveplayerid][pBank] += moneys;
format(string, sizeof(string), " You have transferd $%d to %s's account", moneys, giveplayer,giveplayerid);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, 0xB4B5B7FF, string);
format(string, sizeof(string), " You have recieved $%d to into your account from %s", moneys, sendername, playerid);
SendClientMessage(giveplayerid, 0xB4B5B7FF, string);
format(string, sizeof(string), "%s transferd $%d to %s", sendername, moneys, giveplayer);
if(moneys >= 500000)
{
ABroadCast(COLOR_YELLOW,string,1);
}
printf("%s", string);
PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
}
else
{
SendClientMessage(playerid, 0xB4B5B7FF, " Invalid transaction amount.");
}
}
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, 0xB4B5B7FF, string);
}
}
return 1;
}
return 0;
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
C:\Users\Nexotronix\Desktop\test server\filterscripts\bank.pwn(50) : error 017: undefined symbol "strtok" C:\Users\Nexotronix\Desktop\test server\filterscripts\bank.pwn(50) : error 033: array must be indexed (variable "tmp") C:\Users\Nexotronix\Desktop\test server\filterscripts\bank.pwn(55) : error 017: undefined symbol "PlayerInfo" C:\Users\Nexotronix\Desktop\test server\filterscripts\bank.pwn(55) : warning 215: expression has no effect C:\Users\Nexotronix\Desktop\test server\filterscripts\bank.pwn(55) : error 001: expected token: ";", but found "]" C:\Users\Nexotronix\Desktop\test server\filterscripts\bank.pwn(55) : error 029: invalid expression, assumed zero C:\Users\Nexotronix\Desktop\test server\filterscripts\bank.pwn(55) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 6 Errors.
|
Originally Posted by MadeMan
Copy the code from there to your script. It also shows what you have to have under OnPlayerCommandText.
https://sampwiki.blast.hk/wiki/Strtok |
|
Originally Posted by MadeMan
Strtok is strcmp
![]() |
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);