Faltou vocк definir algumas coisas do strtok na public OnGameModeInit, agora eu jб arrumei.
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
#include <dini>
#include <dudb.inc>
#define LugarCofre 3382.7656,2355.9126,3.4335
#define Admin IsPlayerAdmin
#define Radio 20
#pragma unused ret_memcpy
new
Cofre;
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
//==============================================================================
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Sistema de Banco Admin ");
print("--------------------------------------\n");
if(!dini_Exists("Cofre.ini")) dini_Create("Cofre.ini");
Cofre = dini_Int("Cofre.ini", "Cofre");
return 1;
}
//==============================================================================
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256],
idx,
tmp[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/asaldo", true) == 0)
{
new string[256];
if(!Admin(playerid)) return SendClientMessage(playerid,GetPlayerColor(playerid), "Vocк nгo e admin amigao ):");
format(string, sizeof(string), "O Banco Atualmente tem: %d", Cofre);
SendClientMessage(playerid,GetPlayerColor(playerid), string);
return true;
}
if(strcmp(cmd, "/adepositar", true) == 0)
{
new string[100];
tmp = strtok(cmdtext, idx);
if(!Admin(playerid)) return SendClientMessage(playerid,GetPlayerColor(playerid), "Vocк nгo e admin amigao ):");
if(!strval(tmp)) return SendClientMessage(playerid, GetPlayerColor(playerid), "Use /depositar [dinheiro].");
if(strval(tmp) < GetPlayerMoney(playerid)) return SendClientMessage(playerid, GetPlayerColor(playerid), "Vocк nгo tem essa quantia");
if(PlayerToPoint(Radio, playerid, LugarCofre)){
format(string, sizeof(string), "Vocк depositou: %d.", strval(tmp));
SendClientMessage(playerid, GetPlayerColor(playerid), string);
Cofre += strval(tmp);
GivePlayerMoney(playerid,-strval(tmp));
dini_IntSet("Cofre.ini","Cofre",Cofre);
} else SendClientMessage(playerid, GetPlayerColor(playerid), "Vocк nгo esta perto do cofre");
return 1;
}
if(strcmp(cmd, "/asacar", true) == 0)
{
new string[100];
tmp = strtok(cmdtext, idx);
if(!Admin(playerid)) return SendClientMessage(playerid,GetPlayerColor(playerid), "Vocк nгo e admin amigao ):");
if(!strval(tmp)) return SendClientMessage(playerid, GetPlayerColor(playerid), "Use /sacar [dinheiro].");
if(strval(tmp) < Cofre) return SendClientMessage(playerid, GetPlayerColor(playerid), "O banco nao tem isso tudo");
if(PlayerToPoint(Radio, playerid, LugarCofre)){
format(string, sizeof(string), "Vocк Sacou: %d.", strval(tmp));
SendClientMessage(playerid, GetPlayerColor(playerid), string);
Cofre -= strval(tmp);
GivePlayerMoney(playerid,strval(tmp));
dini_IntSet("Cofre.ini","Cofre",Cofre);
}else SendClientMessage(playerid, GetPlayerColor(playerid), "Vocк nгo esta perto do cofre");
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;
}
//==============================================================================