Sziasztok, ahogy a témában is meg van adva, belekezdtem egy rövid mód írásba még nem tartok sehol, máris gond van.
A Pawno mûködése leállt..
Miért? Mitõl?
//=========================================================================INCUDE
#include
#include
#include
#include
//=========================================================================SZINEK
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_LIGHTBLUE 0x006FDD96
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_FADE 0xC8C8C8C8
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_GRAD6 0xF0F0F0FF
#define TEAM_HIT_COLOR 0xFFFFFF00
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_RED 0xAA3333AA
#define COLOR_LIME 0x10F441AA
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_NAVY 0x000080AA
#define COLOR_AQUA 0xF0F8FFAA
#define COLOR_CRIMSON 0xDC143CAA
#define COLOR_FLBLUE 0x6495EDAA
#define COLOR_BISQUE 0xFFE4C4AA
#define COLOR_BLACK 0x000000AA
#define COLOR_CHARTREUSE 0x7FFF00AA
#define COLOR_BROWN 0XA52A2AAA
#define COLOR_CORAL 0xFF7F50AA
#define COLOR_GOLD 0xB8860BAA
#define COLOR_GREENYELLOW 0xADFF2FAA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_IVORY 0xFFFF82AA
#define COLOR_LAWNGREEN 0x7CFC00AA
#define COLOR_SEAGREEN 0x20B2AAAA
#define COLOR_LIMEGREEN 0x32CD32AA
#define COLOR_MIDNIGHTBLUE 0X191970AA
#define COLOR_MAROON 0x800000AA
#define COLOR_OLIVE 0x808000AA
#define COLOR_ORANGERED 0xFF4500AA
#define COLOR_PINK 0xFFC0CBAA
#define COLOR_SPRINGGREEN 0x00FF7FAA
#define COLOR_TOMATO 0xFF6347AA
#define COLOR_YELLOWGREEN 0x9ACD32AA
#define COLOR_MEDIUMAQUA 0x83BFBFAA
#define COLOR_MEDIUMMAGENTA 0x8B008BAA
//=========================================================================DEFINÍCIÓK
#define SCM SendClientMessage
#define SCMTA SendClientMessageToAll
#define PATH \"Accok/%s.ini\"
//=========================================================================ENUMOK
enum pInfo
{
pPass, //Jelszó
pCash, //Pénz
pLevel, //Szint
Float:pPos_x, //Játékos X
Float:pPos_y, //Játékos Y
Float:pPos_z, //Játékos Z
pSkin, //Skinid
pJob, //Ez jelzi mit dolgozik ha job=1 rendõr ha job=2 mentõs
pWarn, //Figyelmeztetések száma
pTeam, //Alap esetben 0 ha banda1-be lessz akkor 1 ha banda2 akkor 2 (Csak a bandánál kap csapatszámot.)
bank, //Bank-ban lévõ pénzünk
weapon1, //Fegyver1: ha ez a szám 1 akkor van 1 fegyvere ha 0 akkor nincs
weapon1ID, //Ha van fegyvere akkor ez dönti el milyen pl colt: 12
weapon1ammo, //Fegyver-ben lévõ töltények száma
weapon2,
weapon2ID,
weapon2ammo,
weapon3,
weapon3ID,
weapon3ammo,
jobcar, //Frakció autó (van-e) ha 1 akkor olyan helyen dolgozik ahol van autó
jobcarid //Frakcióautó ID-je minden frakciónál másak az autó id-k.
}
//-------------------------------------------------------------------------------
enum vInfo
{
ID, //Jármû idje
LID, //Lekérõid
Rendszam, //Rendszám
Ertek, //Értéke ár:ft
Tulaj, //Kié
Float:c_x,
Float:c_y, //Koordináták
Float:c_z,
Float:c_a
}
//=========================================================================FORWARDOK
//=========================================================================GLOBÁLIS VÁLTOZÓK
new PlayerInfo[MAX_PLAYERS][pInfo];
new vInfo[MAX_VEHICLES][vInfo];
/* <========================[idáig]========================> */
main()
{
print(\"============================\");
print(\"============================\");
print(\"== TOP Role Play ==\");
print(\"=========BETÖLTVE!==========\");
print(\"======Scripter: Filip=======\");
}
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), \"(( %s csatlakozott a szerverhez. ))\", name);
SCMTA(COLOR_GREY, string);
TogglePlayerClock(playerid, 0);
////////////////////////////////////////////////////////////////////////////
//Beállítjuk a játékost:
PlayerInfo[ playerid ][ pCash ] = 0;
PlayerInfo[ playerid ][ pLevel ] = 0;
PlayerInfo[ playerid ][ pPos_x ] = 0.0;
PlayerInfo[ playerid ][ pPos_y ] = 0.0;
PlayerInfo[ playerid ][ pPos_z ] = 0.0;
PlayerInfo[ playerid ][ pSkin ] = 0;
PlayerInfo[ playerid ][ pJob ] = 0;
PlayerInfo[ playerid ][ pWarn ] = 0;
PlayerInfo[ playerid ][ pTeam ] = 0;
//--------------------------------
PlayerInfo[ playerid ][ bank ] = 0;
//--------------------------------
PlayerInfo[ playerid ][ weapon1 ] = 0;
PlayerInfo[ playerid ][ weapon1ID ] = 0;
PlayerInfo[ playerid ][ weapon1ammo ] = 0;
PlayerInfo[ playerid ][ weapon2 ] = 0;
PlayerInfo[ playerid ][ weapon2ID ] = 0;
PlayerInfo[ playerid ][ weapon2ammo ] = 0;
PlayerInfo[ playerid ][ weapon3 ] = 0;
PlayerInfo[ playerid ][ weapon3ID ] = 0;
PlayerInfo[ playerid ][ weapon3ammo ] = 0;
//======================[Login Rendszer]===========================================================
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), \"LoadUser_%s\", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,\"Üdvözöllek!\",\"Már regisztrálva vagy a szerveren, kérlek jelentkezz be! \\n\\nÍrd be a jelszavad.\",\"Belépés\",\"Kilépés\");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,\"Üdvözöllek!\",\"Úgy tûnik, elõször jársz itt, ezért regisztrálnod kell! \\n\\nÍrd be a jelszavad.\",\"Regisztrál\",\"Kiépés\");
}
return 1;
}
public OnGameModeInit()
{
ShowPlayerMarkers(1); //Játékosok megjelenítése a térképen
ShowNameTags(1);
DisableInteriorEnterExits();
EnableStuntBonusForAll(0);
SetNameTagDrawDistance(10.0);
ManualVehicleEngineAndLights(); //Manuális autómotor indítás, és lámpa kapcsolás
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, \"Regisztrálás...\",\"Érvénytelen jelszót adtál meg.\\nÍrj be egy jelszót új fiók regisztrálásához.\",\"Regisztrál\",\"Kilép\");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,\"data\");
INI_WriteInt(File,\"Password\",udb_hash(inputtext));
INI_WriteInt(File,\"Cash\",0);
INI_WriteInt(File,\"Level\",0);
//--------------------------------
INI_WriteFloat(File,\"Pos_x\",0);
INI_WriteFloat(File,\"Pos_y\",0);
INI_WriteFloat(File,\"Pos_z\",0);
//--------------------------------
INI_WriteInt(File,\"Skin\",0);
INI_WriteInt(File,\"Job\",0);
INI_WriteInt(File,\"Warn\",0);
INI_WriteInt(File,\"Team\",0);
//--------------------------------
INI_WriteInt(File,\"bank\",0);
//--------------------------------
INI_WriteInt(File,\"Weapon1\",0);
INI_WriteInt(File,\"Weapon1ID\",0);
INI_WriteInt(File,\"Weapon1ammo\",0);
INI_WriteInt(File,\"Weapon2\",0);
INI_WriteInt(File,\"Weapon2ID\",0);
INI_WriteInt(File,\"Weapon2ammo\",0);
INI_WriteInt(File,\"Weapon3\",0);
INI_WriteInt(File,\"Weapon3ID\",0);
INI_WriteInt(File,\"Weapon3ammo\",0);
//--------------------------------
INI_Close(File);
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), \"LoadUser_%s\", .bExtra = true, .extra = playerid);
new
tmp2[ 256 ],
playername2[ MAX_PLAYER_NAME ]
;
GetPlayerName(playerid, playername2, sizeof(playername2));
format(tmp2, sizeof(tmp2), \"~w~Szia! ~n~~g~%s\", playername2);
GameTextForPlayer(playerid, tmp2, 5000, 1);
SetTimerEx(\"UnsetFirstSpawn\", 5000, false, \"i\", playerid);
GivePlayerCash(playerid, PlayerInfo[playerid][pCash]);
SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], 1.0, -1, -1, -1, -1, -1, -1);
//Ide jöhet majd a fegyver adás stb
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,\"Belépés\",\"Érvénytelen jelszót adtál meg.\\nÍrd be a jelszavad a belépéshez.\",\"Belép\",\"Kilép\");
}
return 1;
}
}
}
return 1;
}
public OnPlayerSpawn(playerid)
{
if(IsPlayerConnected(playerid))
{
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
SetPlayerToTeamColor(playerid);
Logged[playerid] = 1;
}
if(PlayerInfo[playerid][pPos_x] == 0 && PlayerInfo[playerid][pPos_y] == 0)
{
SetPlayerPos(playerid, 1271.3654,181.0756,19.4705);
Logged[playerid] = 1;
}
else
{
SetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
Logged[playerid] = 1;
}
return 1;
}
public OnPlayerText(playerid, text[])
{
new string[ 128 ], RPName;
GetPlayerName(playerid, RPName, sizeof(RPName));
if(IsPlayerConnected(playerid))
{
format(string, sizeof(string), \"%s mondja: %s\", RPName, text);
SCMTA(COLOR_WHITE, \"string\")
return 0;
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), \"(( %s elhagyta a szervert. ))\", name);
SCMTA(COLOR_GREY, string);
SaveAccountStats(playerid);
return 1;
}
public OnPlayerDeath(playerid)
{
PlayerInfo[playerid][pPos_x]=2025.1678;
PlayerInfo[playerid][pPos_y]=1402.7841;
PlayerInfo[playerid][pPos_z]=17.2090;
return 1;
}
public OnGameModeExit()
{
SaveProperties();
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_SUBMISSION))
{
if (IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicle = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
if(lights < 1)
{
SetVehicleParamsEx(vehicle,engine,1,alarm,doors,bonnet,boot,objective);
}
else
{
SetVehicleParamsEx(vehicle,engine,0,alarm,doors,bonnet,boot,objective);
}
}
}
}
return 1;
}
function SetPlayerToTeamColor(playerid)
{
if(IsPlayerConnected(playerid))
{
SetPlayerColor(playerid,TEAM_HIT_COLOR);
}
}
function SaveAccountStats(playerid)
{
if(Logged[playerid] == 1)
{
new
INI:File = INI_Open(UserPath(playerid))
;
INI_SetTag(File,\"data\");
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
new
Float:x,
Float:y,
Float:z
;
GetPlayerPos(playerid,x,y,z);
PlayerInfo[playerid][pPos_x] = x;
PlayerInfo[playerid][pPos_y] = y;
PlayerInfo[playerid][pPos_z] = z;
INI_WriteInt(File,\"Cash\",PlayerInfo[playerid][pCash]);
INI_WriteInt(File,\"Level\",PlayerInfo[playerid][pLevel]);
//--------------------------------
INI_WriteFloat(File,\"Pos_x\",PlayerInfo[playerid][pPos_x]);
INI_WriteFloat(File,\"Pos_y\",PlayerInfo[playerid][pPos_y]);
INI_WriteFloat(File,\"Pos_z\",PlayerInfo[playerid][pPos_z]);
//--------------------------------
INI_WriteInt(File,\"Skin\",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,\"Job\",PlayerInfo[playerid][pJob]);
INI_WriteInt(File,\"Warn\",PlayerInfo[playerid][pWarn]);
INI_WriteInt(File,\"Team\",PlayerInfo[playerid][pTeam]);
//--------------------------------
INI_WriteInt(File,\"bank\",PlayerInfo[playerid][bank]);
//--------------------------------
INI_WriteInt(File,\"Weapon1\",PlayerInfo[playerid][weapon1]);
INI_WriteInt(File,\"Weapon1ID\",PlayerInfo[playerid][weapon1ID]);
INI_WriteInt(File,\"Weapon1ammo\",PlayerInfo[playerid][weapon1ammo]);
INI_WriteInt(File,\"Weapon2\",PlayerInfo[playerid][weapon2]);
INI_WriteInt(File,\"Weapon2ID\",PlayerInfo[playerid][weapon2ID]);
INI_WriteInt(File,\"Weapon2ammo\",PlayerInfo[playerid][weapon2ammo]);
INI_WriteInt(File,\"Weapon3\",PlayerInfo[playerid][weapon3]);
INI_WriteInt(File,\"Weapon3ID\",PlayerInfo[playerid][weapon3ID]);
INI_WriteInt(File,\"Weapon3ammo\",PlayerInfo[playerid][weapon3ammo]);
INI_Close(File);
}
return 1;
}
function SaveAccounts()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SaveAccountStats(i);
}
}
}
function LoadUser_data(playerid,name[],value[])
{
INI_Int(\"Password\",PlayerInfo[playerid][pPass]);
INI_Int(\"Cash\",PlayerInfo[playerid][pCash]);
INI_Int(\"Level\",PlayerInfo[playerid][pAdmin]);
INI_Float(\"Pos_x\",PlayerInfo[playerid][pPos_x]);
INI_Float(\"Pos_y\",PlayerInfo[playerid][pPos_y]);
INI_Float(\"Pos_z\",PlayerInfo[playerid][pPos_z]);
INI_Int(\"Skin\",PlayerInfo[playerid][pSkin]);
INI_Int(\"Job\",PlayerInfo[playerid][pJob]);
INI_Int(\"Warn\",PlayerInfo[playerid][pWarn]);
INI_Int(\"Team\",PlayerInfo[playerid][pTeam]);
INI_Int(\"bank\",PlayerInfo[playerid][bank]);
INI_Int(\"Weapon1\",PlayerInfo[playerid][weapon1]);
INI_Int(\"Weapon1ID\",PlayerInfo[playerid][weapon1ID]);
INI_Int(\"Weapon1ammo\",PlayerInfo[playerid][weapon1ammo]);
INI_Int(\"Weapon2\",PlayerInfo[playerid][weapon2]);
INI_Int(\"Weapon2ID\",PlayerInfo[playerid][weapon2ID]);
INI_Int(\"Weapon2ammo\",PlayerInfo[playerid][weapon2ammo]);
INI_Int(\"Weapon3\",PlayerInfo[playerid][weapon3]);
INI_Int(\"Weapon3ID\",PlayerInfo[playerid][weapon3ID]);
INI_Int(\"Weapon3ammo\",PlayerInfo[playerid][weapon3ammo]);
return 1;
}
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
/* Credits to Dracoblue */
stock udb_hash(buf[]) {
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n {
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}