Quote
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(125) : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(12😎 : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(647) : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(649) : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(657) : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(65😎 : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(681) : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(692) : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(695) : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(697) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
10 Warnings.
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(12😎 : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(647) : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(649) : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(657) : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(65😎 : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(681) : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(692) : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(695) : warning 217: loose indentation
D:\Server\samp weed core\gamemodes\feuerfrei.pwn(697) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
10 Warnings.
#include
// mysql
#include
//
#include
#include
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
//------------------------------------------------
// define
//------------------------------------------------
// MYsql
#define MYSQL_HOST "127.0.0.1"
#define MYSQL_USER "root"
#define MYSQL_DB "SAMP"
#define MYSQL_PASS ""
#undef MAX_PLAYERS
#define MAX_PLAYERS 50 // maximalni broj playera na serveru
#define COLOR_RED 0xFF0000
#define COLOR_YELLOW 0xFFFF00
#define MAX_HOUSES 250
#define INVALID_HOUSE_ID 255
#define STANDARD_HOUSEVEHICLE 517
//------------------------------------------------
// New
//------------------------------------------------
// user
enum pEnum
{
Name,
Password,
Admin,
Money,
//
PozX,
PozY,
PozZ,
PozInt,
PozDimenzion,
Skin,
//
Job,
JobSkill,
JobRank,
//
Org,
OrgRank,
OrgLeader,
//
Cop,
CopDuty,
Arrest,
ArrestTime,
//
Licence,
LicenceCar,
LicenceHelicopter,
LicenceBike,
LicencePlane,
LicenceBoat,
LicenceTrain
};
new UserStats;
new AccountExists;
new PlayerLogged;
// houses
enum hInfo()
{
hID,
Float:hEntrancePosX,
Float:hEntrancePosY,
Float:hEntrancePosZ,
Float:hExitPosX,
Float:hExitPosY,
Float:hExitPosZ,
hInterior,
hVirtualWorld,
hOwned,
hOwner,
hDescription,
hPrice,
hVec,
hVecColor1,
hVecColor2,
Float:hVecPosX,
Float:hVecPosY,
Float:hVecPosZ,
Float:hVecPosA,
};
new HouseInfo;
new HOUSECAR_SPAWN;
new HOUSE_PICKUP;
//
ConnectMySQL()
{
if(mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS))
print(" Connection to the MySQL Database was successfully!");
else
print(" Could not connect to the MySQL Database!");
}
CheckMySQL()
{
if(mysql_ping() == -1)
mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS);
}
CheckAccountExists(account[])
{
new string;
format(string, sizeof(string), "SELECT * FROM Users WHERE Name = '%s'", account);
mysql_query(string);
mysql_store_result();
new value;
value = mysql_num_rows();
mysql_free_result();
return value;
}
explode(const sSource[], aExplode[][], const sDelimiter[] = " ", iVertices = sizeof aExplode, iLength = sizeof aExplode[]) // Created by Westie
{
new
iNode,
iPointer,
iPrevious = -1,
iDelimiter = strlen(sDelimiter);
while(iNode < iVertices)
{
iPointer = strfind(sSource, sDelimiter, false, iPointer);
if(iPointer == -1)
{
strmid(aExplode, sSource, iPrevious, strlen(sSource), iLength);
break;
}
else
{
strmid(aExplode, sSource, iPrevious, iPointer, iLength);
}
iPrevious = (iPointer += iDelimiter);
++iNode;
}
return iPrevious;
}
stock split(const strsrc[], strdest[][], delimiter)
{
new i, li;
new aNum;
new len;
while(i <= strlen(strsrc))
{
if(strsrc==delimiter || i==strlen(strsrc))
{
len = strmid(strdest, strsrc, li, i, 25);
strdest = 0;
li = i+1;
aNum++;
}
i++;
}
return 1;
}
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("FF v1.0.0");
ConnectMySQL();
ReloadAllHouses();
for(new h = 0; h < MAX_HOUSES; h++)
{
HOUSECAR_SPAWN = CreateVehicle(HouseInfo, HouseInfo, HouseInfo, HouseInfo, HouseInfo, HouseInfo, HouseInfo, -1);
if(HouseInfo == 0)
{
HOUSE_PICKUP = CreatePickup(1273, 1, HouseInfo, HouseInfo, HouseInfo);
}
else
{
HOUSE_PICKUP = CreatePickup(1272, 1, HouseInfo, HouseInfo, HouseInfo);
}
}
SetTimer("UpdatePlayerInfo", 3000, true);
return 1;
}
public OnGameModeExit()
{
mysql_close();
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
return 0;
}
public OnPlayerConnect(playerid)
{
GetPlayerName(playerid, UserStats, MAX_PLAYER_NAME);
new name;
GetPlayerName(playerid, name, sizeof(name));
if(CheckAccountExists(UserStats)) AccountExists = 1;
else AccountExists = 0;
if(AccountExists)
{
new string, string2;
format(string,sizeof(string), "Weed Core SAMP v1.0.0");
format(string2,sizeof(string2), "Dobro dosli! \r\nIME: %s je pronađeno u databazi\r\nMolimo vas da se logirate.",name );
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT , string, string2, "Login", "Exit");
return 1;
}
else
{
new string, string2;
format(string,sizeof(string), "Weed Core SAMP v1.0.0");
format(string2,sizeof(string2), "Dobro dosli! \r\nIME: %s nije registrano\r\nPotrebno ga je registrirati da bi ste mogli zaigrati na serveru.\r\n**Upozorenje** password mora imati vise od 6 znakova",name );
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT , string, string2, "Register", "Exit");
return 1;
}
}
public OnPlayerDisconnect(playerid, reason)
{
SavePlayer(playerid);
UserStats = 0;
UserStats = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SavePlayer(playerid);
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
/*
77------------------------------------------------------------------------------
77 Komande
77------------------------------------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
return 0;
}
http://forum.sa-mp.com/showthread.php?t=91354&highlight=zcmd
ili hr
http://balkan-samp.com/forum/index.php?topic=10516.0
// koristi se
COMMAND:mycommand(playerid, params[]) // or CMD:mycommand(playerid, params[])
{
// Do something
return 1;
}
*/
COMMAND:buyhouse(playerid, params[])
{
#pragma unused params
for(new h = 0; h < MAX_HOUSES; h++)
{
if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo, HouseInfo, HouseInfo))
{
if(HouseInfo == 0)
{
if(GetPlayerMoney(playerid) >= HouseInfo)
{
new pName;
GetPlayerName(playerid, pName, MAX_PLAYER_NAME); GivePlayerMoney(playerid, -HouseInfo);
strmid(HouseInfo, pName, false, strlen(pName), 25);
HouseInfo = STANDARD_HOUSEVEHICLE; HouseInfo = 1;
SendClientMessage(playerid, 0x00FF00AA, "** You have bought this house successfully!");
HOUSE_PICKUP = CreatePickup(1272, 1, HouseInfo, HouseInfo, HouseInfo);
SaveAllHouses();
return 1;
}
else return SendClientMessage(playerid, 0xFF0000AA, "** You don't have enough money for this house!");
}
else return SendClientMessage(playerid, 0xFF0000AA, "** This house is already owned by someone!");
}
}
return 1;
}
COMMAND:sellhouse(playerid, params[])
{
#pragma unused params
for(new h = 0; h < MAX_HOUSES; h++)
{
if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo, HouseInfo, HouseInfo))
{
new pName;
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
if(strcmp(HouseInfo, pName, true) == 0)
{
HouseInfo = 0;
strdel(HouseInfo, 0, strlen(HouseInfo));
GivePlayerMoney(playerid, (HouseInfo/2));
SendClientMessage(playerid, 0x00FF00AA, "** You sold this house!");
HOUSE_PICKUP = CreatePickup(1272, 1, HouseInfo, HouseInfo, HouseInfo);
SaveAllHouses();
}
else return SendClientMessage(playerid, 0xFF0000AA, "** You only can sell your own houses!");
}
}
return 1;
}
COMMAND:housecar(playerid, params[])
{
new houseid,vehicle,pName;
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
if(sscanf(params, "dd", houseid, vehicle)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /housecar ");
if(strcmp(HouseInfo, pName, true) == 0)
{
HouseInfo = vehicle;
DestroyVehicle(HOUSECAR_SPAWN);
HOUSECAR_SPAWN = CreateVehicle(HouseInfo, HouseInfo, HouseInfo, HouseInfo, HouseInfo, HouseInfo, HouseInfo, -1);
GivePlayerMoney(playerid, -1500);
}
else return SendClientMessage(playerid, 0xFF0000AA, "** You can only do actions by your own houses!");
return 1;
}
COMMAND:hccolor(playerid, params[])
{
new houseid,clr1,clr2,pName;
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
if(sscanf(params, "ddd", houseid, clr1, clr2)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /hccolor ");
if(strcmp(HouseInfo, pName, true) == 0)
{
HouseInfo = clr1; HouseInfo = clr2;
ChangeVehicleColor(HOUSECAR_SPAWN, clr1, clr2);
GivePlayerMoney(playerid, -150);
}
else return SendClientMessage(playerid, 0xFF0000AA, "** You can only dp actions by your own houses!");
return 1;
}
COMMAND:enterhouse(playerid, params[])
{
#pragma unused params
for(new h = 0; h < MAX_HOUSES; h++)
{
if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo, HouseInfo, HouseInfo))
{
new pName;GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
if(strcmp(HouseInfo, pName, true) == 0)
{
SetPlayerVirtualWorld(playerid, HouseInfo); SetPlayerInterior(playerid, HouseInfo);
SetPlayerPos(playerid, HouseInfo, HouseInfo, HouseInfo);
return 1;
}
}
}
return 1;
}
COMMAND:exithouse(playerid, params[])
{
#pragma unused params
for(new h = 0; h < MAX_HOUSES; h++)
{
if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo, HouseInfo, HouseInfo))
{
SetPlayerVirtualWorld(playerid, 0);SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, HouseInfo, HouseInfo, HouseInfo);
return 1;
}
}
return 1;
}
COMMAND:tphouse(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new houseid,Float:pX,Float:pY,Float:pZ,vir,int;
if(sscanf(params, "d", houseid)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /tphouse ");
GetPlayerPos(playerid, pX, pY, pZ); vir = GetPlayerVirtualWorld(playerid); int = GetPlayerInterior(playerid);
HouseInfo = pX; HouseInfo = pY; HouseInfo = pZ;
HouseInfo = vir; HouseInfo = int;
}
return 1;
}
COMMAND:tphousecar(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:pX,Float:pY,Float:pZ,Float:pA,houseid;
if(sscanf(params, "d", houseid)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /tphousecar ");
GetVehiclePos(GetPlayerVehicleID(playerid), pX, pY, pZ); GetVehicleZAngle(GetPlayerVehicleID(playerid), pA);
HouseInfo = pX; HouseInfo = pY; HouseInfo = pZ; HouseInfo = pA;
DestroyVehicle(HOUSECAR_SPAWN);
HOUSECAR_SPAWN = CreateVehicle(HouseInfo, HouseInfo, HouseInfo, HouseInfo, HouseInfo, HouseInfo, HouseInfo, -1);
return 1;
}
else return SendClientMessage(playerid, 0xFF0000AA, "** You need to be in an vehicle!");
}
return 1;
}
COMMAND:savehouses(playerid, params[])
{
#pragma unused params
if(IsPlayerAdmin(playerid))
{
SaveAllHouses();
}
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
/// login / register
if(dialogid == 0)
{
if(!response) return SendClientMessage(playerid, 0xFFFFFFFF, "Morate se Ulogirati da bi ste igrali na serveru!"), Kick( playerid );
LoginPlayer(playerid, inputtext);
return 1;
}
if(dialogid == 1)
{
if(!response) return SendClientMessage(playerid, 0xFFFFFFFF, "Morate se Registrirati da bi ste igrali na serveru!"), Kick( playerid );
if(strlen(inputtext)>6)
{
RegisterPlayer(playerid, inputtext);
}
else
{
new string, string2;
format(string,sizeof(string), "Weed Core SAMP v1.0.0");
format(string2,sizeof(string2), "Password je prekratak mora sadrzavati minimalno 6 znakova");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT , string, string2, "Register", "Exit");
}
return 1;
}
return 0;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
///////////////////////////-------------------------------------------
///////////////////////////-------------------------------------------
///////////////////////////-------------------------------------------
/////////////////////////// Accaunt
///////////////////////////-------------------------------------------
RegisterPlayer(playerid, password[])
{
CheckMySQL();
new string;
format(string, sizeof(string), "INSERT INTO Users (Name,Password) VALUES ('%s','%s')", UserStats, password);
mysql_query(string);
AccountExists = 1;
LoginPlayer(playerid, password);
return 1;
}
LoginPlayer(playerid, password[])
{
CheckMySQL();
new string;
format(string, sizeof(string), "SELECT * FROM Users WHERE Name = '%s' AND Password = '%s'", UserStats, password);
mysql_query(string);
mysql_store_result();
if(!mysql_num_rows())
return SendClientMessage(playerid, COLOR_RED, "Kick razlog: Netocan password!"), Kick(playerid);
new row; // The length of 1 'row' total.
new field; // = Amount of fields, = Max length of the bigest field.
mysql_fetch_row_format(row, "|");
explode(row, field, "|");
mysql_free_result();
// The field starts here with 1, because the field 'Name' = 0, and we already have the name in a variable.
format(UserStats, 32, "%s", field);
UserStats = strval(field);
UserStats = strval(field);
GivePlayerMoney(playerid, UserStats);
format(string, sizeof(string), " Welcome back %s, sad se ulogirani! Ugodnu igru i zabavu.", UserStats);
SendClientMessage(playerid, COLOR_YELLOW, string);
PlayerLogged = 1;
return 1;
}
SavePlayer(playerid)
{
if(!PlayerLogged)
return 0;
UserStats = GetPlayerMoney(playerid);
CheckMySQL();
new string;
format(string, sizeof(string), "UPDATE Users SET Password='%s',Admin='%d',Money='%d' WHERE Name='%s'", UserStats, UserStats, UserStats, UserStats);
mysql_query(string);
return 1;
}
///////////////////////////-------------------------------------------
///////////////////////////-------------------------------------------
///////////////////////////-------------------------------------------
/////////////////////////// Houses
///////////////////////////-------------------------------------------
forward SaveAllHouses();
public SaveAllHouses()
{
new h;
new File:houses;
while(h < MAX_HOUSES)
{
new string;
format(string, sizeof(string), "%d,%f,%f,%f,%f,%f,%f,%d,%d,%d,%s,%s,%d,%d,%d,%d,%f,%f,%f,%f\r\n",
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo,
HouseInfo);
if(h == 0)
{
houses = fopen("Houses.cfg", io_write);
}
else
{
houses = fopen("Houses.cfg", io_append);
}
fwrite(houses, string);
h++;
fclose(houses);
}
h = 0;
return 1;
}
forward ReloadAllHouses();
public ReloadAllHouses()
{
new string;
new arrCoords;
new File:houses = fopen("Houses.cfg", io_read);
new h;
if(houses)
{
while(h < MAX_HOUSES)
{
fread(houses, string);
split(string, arrCoords, ',');
HouseInfo = strval(arrCoords);
HouseInfo = floatstr(arrCoords);
HouseInfo = floatstr(arrCoords);
HouseInfo = floatstr(arrCoords);
HouseInfo = floatstr(arrCoords);
HouseInfo = floatstr(arrCoords);
HouseInfo = floatstr(arrCoords);
HouseInfo = strval(arrCoords);
HouseInfo = strval(arrCoords);
HouseInfo = strval(arrCoords);
strmid(HouseInfo, arrCoords, false, strlen(arrCoords), MAX_PLAYER_NAME);
strmid(HouseInfo, arrCoords, false, strlen(arrCoords), 35+1);
HouseInfo = strval(arrCoords);
HouseInfo = strval(arrCoords);
HouseInfo = strval(arrCoords);
HouseInfo = strval(arrCoords);
HouseInfo = floatstr(arrCoords);
HouseInfo = floatstr(arrCoords);
HouseInfo = floatstr(arrCoords);
HouseInfo = floatstr(arrCoords);
h++;
}
}
fclose(houses);
return 1;
}
forward UpdatePlayerInfo();
public UpdatePlayerInfo()
{
new string;
for(new i = 0; i < MAX_PLAYERS; i++)
{
for(new h = 0; h < MAX_HOUSES; h++)
{
if(IsPlayerInRangeOfPoint(i, 2, HouseInfo, HouseInfo, HouseInfo))
{
if(HouseInfo == 0)
{
format(string, sizeof(string), "~w~This house is for sale!~n~Typ ~y~/buyhouse~w~ to buy this house for:~g~~n~$%d,-", HouseInfo);
}
else
{
format(string, sizeof(string), "~w~House owned by ~r~%s", HouseInfo);
}
GameTextForPlayer(i, string, 2000, 3);
}
}
}
return 1;
}zašto mi se gubi ? prije je OK radilo i odjenom sere :S
dali sam dao dovoljno podataka ?
koristim mysql pluing http://forum.sa-mp.com/showthread.php?t=56564
i sscanf2 http://forum.sa-mp.com/showthread.php?t=120356
i zcmd http://forum.sa-mp.com/showthread.php?t=91354&highlight=zcmd