rendered paste body#include <a_samp>
//#include <core>
//#include <float>
//#include <file>
#include <dudb>
//#include <dini>
//#include <dutils>
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_SYSTEM_PW 0xFFFF33AA // YELLOW (FFFF33) system personal warning ("you must be in a bank")
#define COLOR_MENU 0xFFFFFFAA // WHITE (FFFFFF) menu's (/help)
#define COLOR_SYSTEM_GM 0xFF9966AA // LIGHT ORANGE-RED (FF9966) system generated general message ("x just bought the four dragons!")
#define GAMBLE_LICENCE 2500000
//#define dcmd(%1,%2,%3) if ((strcmp(%3, "/%1", true, %2+1) == 0)&&(((%3[%2+1]==0)&&(dcmd_%1(playerid,"")))||((%3[%2+1]==32)&&(dcmd_%1(playerid,%3[%2+2]))))) return 1
#define FILE_SETTINGS "settings.ini"
#define MAX_3DLOCS 3
new Float:casCoords[MAX_3DLOCS][6] = { // {Xmin, Ymin, Zmin, Xmax, Ymax, Zmax}
{1925.1511,968.2360,992.4687,1982.3024,1067.4122,995.5211}, // four dragons
{2179.5100,1559.0856,1000.0,2281.1492,1622.9048,1010.0}, //caligula
{1113.6541,-13.2672,1000.6718,1143.2858,12.4690,1003.0662} // redsands casino
};
new Float:casSpawn[MAX_3DLOCS][3] = {
{2030.2551,1007.9247,10.8203}, // four dragons
{2186.8896,1680.6750,11.1027}, //caligula
{1658.9501,2255.8767,10.8203} // redsands casino
};
new gamblelicence[MAX_PLAYERS];
//new spawned[MAX_PLAYERS];
new logged[MAX_PLAYERS];
new playername[MAX_PLAYER_NAME];
new strings[256];
new Float:X250[MAX_PLAYERS];
new Float:Y250[MAX_PLAYERS];
new Float:Z250[MAX_PLAYERS];
new isincasino[MAX_PLAYERS];
new currentmoney[MAX_PLAYERS];
new tmps1[256];
new GameTextForPlayers1[MAX_PLAYERS][36];
new GameTextForPlayers2[MAX_PLAYERS][36];
new GameTextForPlayersCounter[MAX_PLAYERS];
public OnFilterScriptInit()
{
//print("--CASINO GAMBLE--");
SetTimer("CasinoUpdate", 1100, 1);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[]){
new cmd[256];
if(strcmp(cmd, "/gamble", true) == 0) {
//#pragma unused params
if (logged[playerid] == 1){
tmps1 = dini_Get(FILE_SETTINGS, "casinos");
if (strval(tmps1) == 0) {
SendClientMessage(playerid, COLOR_SYSTEM_PW, "* Casinos sind auf dem Server nicht erlaubt!");
return 1;
}
GetPlayerName(playerid, playername, sizeof(playername));
if (gamblelicence[playerid] == 1) {
SendClientMessage(playerid, COLOR_SYSTEM_PW, "* Du hast bereits eine GambleLizens");
return 1;
}
if (logged[playerid] == 0) {
SendClientMessage(playerid, COLOR_SYSTEM_PW, "* Bitte logge dich ein, um zu spielen.");
return 1;
}
if (GetPlayerMoney(playerid) >= 7500){
// TO-DO money scanner update
//format(moneyreason, sizeof(moneyreason), "* Money decreased by $%d (old: $%d), because player-id %d bought a gamble licence",GAMBLE_LICENCE, GetPlayerMoney(playerid), playerid);
GivePlayerMoney(playerid, -7500);
dini_IntSet(udb_encode(playername), "gamblelicence", 1);
gamblelicence[playerid] = 1;
format(strings, sizeof(strings), "--- %s (id: %d) bought a gamble licence for %d.", playername,playerid,GAMBLE_LICENCE);
printf(strings);
format(strings, sizeof(strings), "* %s (id: %d) bought a gamble licence for %d.", playername,playerid,GAMBLE_LICENCE);
SendClientMessageToAll(COLOR_SYSTEM_GM, strings);
} else {
format(strings, sizeof(strings), "* Du hast nicht genug Geld fuer eine Spiellizens. Sie kostet $7500.", GAMBLE_LICENCE);
SendClientMessage(playerid, COLOR_SYSTEM_PW, strings);
return 1;
}
}
return 1;
}
return 0;
}
public CasinoUpdate()
{
tmps1 = dini_Get(FILE_SETTINGS, "casinos");
for(new i=0; i<MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
for(new j=0; j < MAX_3DLOCS; j++) {
if(X250[i] >= casCoords[j][0] && X250[i] <= casCoords[j][3] && Y250[i] >= casCoords[j][1] && Y250[i] <= casCoords[j][4] && Z250[i] >= casCoords[j][2] && Z250[i] <= casCoords[j][5]) {
if (strval(tmps1) == 1) {
if(gamblelicence[i] == 1) {
isincasino[i] = 1;
currentmoney[i] = GetPlayerMoney(i);
return 1;
} else {
format(GameTextForPlayers1[i], 36, "~w~DU HAST KEINE GAMBLE LICENCE");
format(GameTextForPlayers2[i], 36, "KAUFE EINE MIT /GAMBLE!");
GameTextForPlayersCounter[i]=5;
SetPlayerInterior(i, 0);
SetPlayerPos(i, casSpawn[j][0], casSpawn[j][1], casSpawn[j][2]);
return 1;
}
} else {
GameTextForPlayer(i,"~w~CASINOS SIND ILLEGAL. VERDIENTE DEIN GELD ANDERS!",5000,3);
SetPlayerInterior(i, 0);
SetPlayerPos(i, casSpawn[j][0], casSpawn[j][1], casSpawn[j][2]);
return 1;
}
} else {
if(isincasino[i] == 1){
isincasino[i] = 0;
}
}
}
}
}
return 1;
}