Y_ini Not Saving!
#1


hello i'm using Y_INI! When i register and quit without shutdown the server Y_INI works perfect player data reload!
But when i shutdown the server and join server PlayerData dont reloadddd how can i fix this pleasee i need help


Helpppp
Reply
#2

First of all, just use normal characters.
Show us your code, we're not magicians to say where the errors are.
Reply
#3

I use y_ini too, and I notice this error as-well. The best advice I can give you is just to /q before you gmx or close the server.
Reply
#4

More efficient idea is to make a command /savestats , that re-saves your data in the players file. Anyway if you are searching for any system you may take mine.
Код:
#include <a_samp>
#include <YSI\y_ini>
#include <zcmd>
#include <streamer>

//LOGIN REGISTER SYSTEM
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#define PATH "/Users/%s.ini"
//END
enum pInfos
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pVirtualWorld,
    pPosx,
    pPosy,
    pPosz,
    pDeaths
}
new pInfo[MAX_PLAYERS][pInfos];
//Login register system
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
	INI_Int("Password",pInfo[playerid][pPass]);
	INI_Int("Cash",pInfo[playerid][pCash]);
	INI_Int("Admin",pInfo[playerid][pAdmin]);
	INI_Int("Kills",pInfo[playerid][pKills]);
    INI_Int("Deaths",pInfo[playerid][pDeaths]);

 	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;
}
stock udb_hash(buf[]) {
	new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}
//End
public OnPlayerConnect(playerid)
{
	//Login Register system
    if(fexist(UserPath(playerid)))
	{
		INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  		ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","Type your password below to login.","Login","Quit");
	}
	else
	{
 		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"REGISTER","Type your password below to register a new account to join Flement Age of Empires.","Register","Quit");
	}
	//END
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	
	
	//Login Register system
	new INI:File = INI_Open(UserPath(playerid));
	INI_SetTag(File,"data");
	INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
	INI_WriteInt(File,"Admin",pInfo[playerid][pAdmin]);
	INI_WriteInt(File,"Kills",pInfo[playerid][pKills]);
	INI_WriteInt(File,"Deaths",pInfo[playerid][pDeaths]);

	INI_Close(File);
	//End
	return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, pInfo[playerid][pPosx], pInfo[playerid][pPosy], pInfo[playerid][pPosz]+0.3);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	pInfo[killerid][pKills]++;
	pInfo[playerid][pDeaths]++;
	return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	//Login and Register system
	switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
                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,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
          
        
                INI_Close(File);
			}


        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == pInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, pInfo[playerid][pCash]);
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    //END
	return 1;
}
Reply
#5

hello i'm not in my PC right now and can't give my code butt i have /register command !
Should i make a /savestats command or can i put a time for saving player data ?
Reply
#6

Make it and return the savestats cmds when the player disconnects
Reply
#7

PHP код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <streamer>
#include <YSI\y_ini>
//=============Defines.=========================================================
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#define PATH "/Users/%s.ini"
#define COLOR_TIME 0xFFFFFFFF 
#define COLOR_DAY  0xFFFFFFFF 
#define MINUTE 1000
#define ERROR_MSG "Unknown Command! Type /cmds For Available Commands."
//===============================colors=========================================
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ADMIN 0xFF40FFFF
#define COLOR_RED 0xFF0000FF
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
//=====================================emums====================================
enum pInfo
{
    
pPass,
    
pCash,
    
pAdmin,
    
pKills,
    
pDeaths,
    
pRegistered,
    
pLogedin,
    
pClass,
    
pTeam,
    
pSkill
    
}
new 
PlayerInfo[MAX_PLAYERS][pInfo];
#define TEAM_LAW 1
#define TEAM_CIVILIAN 2
#define SKILL_NONE 0
#define SKILL_COP 1
#define SKILL_THIEF 2
#define SKILL_DRUGDEALER 3
#define SKILL_PROSTITUTE 4
#define SKILL_HITMAN 5
#define SKILL_CARJACKER 6
#define SKILL_RAPIST 7
#define SKILL_KIDNAPPER 8
#define SKILL_MEDIC 9
#define SKILL_ARMSDEALER 10
#define SKILL_STREETVENDOR 11
#define SKILL_MECHANIC 12
#define SKILL_FOODVENDOR 13
enum Pedinfo
{
    
Class_Id,
    
Class_Name[128],
       
Spawn_TeamId,
       
Spawn_SkillId,
    
Spawn_SkinId,
    
Float:Spawn_X,
    
Float:Spawn_Y,
    
Float:Spawn_Z,
    
Float:Spawn_A
}
new 
Peds[][Pedinfo] = {
{
0    ,"~b~Public Service~n~~g~Police Officer"    ,TEAM_LAW    ,SKILL_COP    ,280    ,2294.0832512451.57836910.82031289.162681    },
{
1    ,"~b~Public Service~n~~g~Police Officer"    ,TEAM_LAW    ,SKILL_COP    ,281    ,2294.0832512451.57836910.82031289.162681    },
{
2    ,"~b~Public Service~n~~g~Police Officer"    ,TEAM_LAW    ,SKILL_COP    ,282    ,2294.0832512451.57836910.82031289.162681    },
{
3    ,"~b~Public Service~n~~g~County Sheriff"    ,TEAM_LAW    ,SKILL_COP    ,283    ,-213.359344979.49389619.332237272.853759    },
{
4    ,"~b~Public Service~n~~g~County Sheriff"    ,TEAM_LAW    ,SKILL_COP    ,288    ,-213.359344979.49389619.332237272.853759    },
{
5    ,"~b~Public Service~n~~g~Motor Cycle Cop"    ,TEAM_LAW    ,SKILL_COP    ,284    ,2294.0832512451.57836910.82031289.162681    },
{
6    ,"~b~Public Service~n~~g~S.W.A.T"            ,TEAM_LAW    ,SKILL_COP    ,285    ,2282.1115722426.139648, -7.250000357.726348    },
{
7    ,"~b~Public Service~n~~g~F.B.I"                ,TEAM_LAW    ,SKILL_COP    ,286    ,2282.1115722426.139648, -7.250000357.726348    },
{
8    ,"~b~Public Service~n~~g~Secret Service"    ,TEAM_LAW    ,SKILL_COP    ,163    ,945.7587281733.1721198.851562271.162628    },
{
9    ,"~b~Public Service~n~~g~Secret Service"    ,TEAM_LAW    ,SKILL_COP    ,164    ,945.7587281733.1721198.851562271.162628    },
{
10    ,"~b~Public Service~n~~g~C.I.A"                ,TEAM_LAW    ,SKILL_COP    ,165    ,945.7587281733.1721198.851562271.162628    },
{
11    ,"~b~Public Service~n~~g~C.I.A"                ,TEAM_LAW    ,SKILL_COP    ,166    ,945.7587281733.1721198.851562271.162628    },
{
12    ,"~b~Public Service~n~~g~Police Officer"    ,TEAM_LAW    ,SKILL_COP    ,211    ,2282.2385252426.2399903.469186359.821960    },
{
13    ,"~b~Public Service~n~~g~Police Officer"    ,TEAM_LAW    ,SKILL_COP    ,192    ,2282.2385252426.2399903.469186359.821960    },
{
14    ,"~b~Public Service~n~~g~Military"            ,TEAM_LAW    ,SKILL_COP    ,287    ,2282.1115722426.139648, -7.250000357.726348    },
{
15    ,"~b~Public Service~n~~g~Security Guard"    ,TEAM_LAW    ,SKILL_COP    ,71        ,1319.2547601256.16638110.820312357.406555    },
{
16    ,"~b~Public Service~n~~g~Vigilante"            ,TEAM_LAW    ,SKILL_COP    ,217    ,2282.1115722426.139648, -7.250000357.726348    },
{
17    ,"~b~Public Service~n~~g~Paramedic"            ,TEAM_LAW    ,SKILL_MEDIC,274    ,1608.0015,1824.9731,10.8203,0.9841    },
{
18    ,"~b~Public Service~n~~g~Paramedic"            ,TEAM_LAW    ,SKILL_MEDIC,275    ,1608.0015,1824.9731,10.8203,0.9841    },
{
19    ,"~b~Public Service~n~~g~Paramedic"            ,TEAM_LAW    ,SKILL_MEDIC,276    ,1608.0015,1824.9731,10.8203,0.9841    },
{
20    ,"~b~Public Service~n~~g~Fire Fighter"        ,TEAM_LAW    ,SKILL_MEDIC,277    ,1743.8276362082.03222610.820312181.575714    },
{
21    ,"~b~Public Service~n~~g~Fire Fighter"        ,TEAM_LAW    ,SKILL_MEDIC,278    ,1743.8276362082.03222610.820312181.575714    },
{
22    ,"~b~Public Service~n~~g~Fire Fighter"        ,TEAM_LAW    ,SKILL_MEDIC,279    ,1743.8276362082.03222610.820312181.575714    },
{
23    ,"~w~Service~n~~g~Taxi Driver"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,262    ,1433.3040772662.74584911.392612357.286621    },
{
24    ,"~w~Service~n~~g~Limo Driver"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,255    ,2021.6168211912.84814412.309042270.408386    },
{
25    ,"~w~Service~n~~g~Bus Driver"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,253    ,2840.6999511290.51416011.39062588.384742        },
{
26    ,"~w~Service~n~~g~Pilot"                    ,TEAM_CIVILIAN    ,SKILL_NONE    ,61        ,1308.2630611614.66809010.820312265.438659    },
{
27    ,"~w~Service~n~~y~Food Delivery"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,167    ,2024.8580321545.40661610.820312274.217559    },
{
28    ,"~w~Service~n~~y~Food Delivery"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,205    ,2024.8580321545.40661610.820312274.217559    },
{
29    ,"~w~Service~n~~y~Food Delivery"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,155    ,2024.8580321545.40661610.820312274.217559    },
{
30    ,"~w~Service~n~~y~Food Delivery"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,209    ,2024.8580321545.40661610.820312274.217559    },
{
31    ,"~w~STREET THUG"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,7    ,2024.8580321545.40661610.820312274.217559    },
{
32    ,"~w~BUSINESS WOMAN"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,9    ,2024.8580321545.40661610.820312274.217559    },
{
33    ,"~w~RAPPING GRANDMA"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,10    ,2024.8580321545.40661610.820312274.217559    },
{
34    ,"~w~GOLD DIGGER"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,12    ,2024.8580321545.40661610.820312274.217559    },
{
35    ,"~w~GANGSTER BITCH"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,13    ,2024.8580321545.40661610.820312274.217559    },
{
36    ,"~w~NICE OLD MAN"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,14    ,2024.8580321545.40661610.820312274.217559    },
{
37    ,"~w~TRUCK DRIVER"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,15    ,2024.8580321545.40661610.820312274.217559    },
{
38    ,"~w~BUSINESS MAN"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,17    ,2024.8580321545.40661610.820312274.217559    },
{
39    ,"~w~RAPPER"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,19    ,2024.8580321545.40661610.820312274.217559    },
{
40    ,"~w~LADIES MAN"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,20    ,2024.8580321545.40661610.820312274.217559    },
{
41    ,"~w~GANGSTA"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,21    ,2024.8580321545.40661610.820312274.217559    },
{
42    ,"~w~STREET THUG"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,22    ,2024.8580321545.40661610.820312274.217559    },
{
43    ,"~w~SKATER"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,23    ,2024.8580321545.40661610.820312274.217559    },
{
44    ,"~w~GANGSTA"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,24    ,2024.8580321545.40661610.820312274.217559    },
{
45    ,"~w~CAMPER"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,26    ,2024.8580321545.40661610.820312274.217559    },
{
46    ,"~w~PUSHER"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,28    ,2024.8580321545.40661610.820312274.217559    },
{
47    ,"~w~DRUG DEALER"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,29    ,2024.8580321545.40661610.820312274.217559    },
{
48    ,"~w~CAR THIEF"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,30    ,2024.8580321545.40661610.820312274.217559    },
{
49    ,"~w~COWBOY GRANDMA"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,31    ,2024.8580321545.40661610.820312274.217559    },
{
50    ,"~w~FISHERMAN"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,32    ,2024.8580321545.40661610.820312274.217559    },
{
51    ,"~w~KIDNAPPER"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,33    ,2024.8580321545.40661610.820312274.217559    },
{
52    ,"~w~COWBOY"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,34    ,2024.8580321545.40661610.820312274.217559    },
{
53    ,"~w~TOUR GUIDE"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,35    ,2024.8580321545.40661610.820312274.217559    },
{
54    ,"~w~GOLFER"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,36    ,2024.8580321545.40661610.820312274.217559    },
{
55    ,"~w~GRANDMA"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,38    ,2024.8580321545.40661610.820312274.217559    },
{
56    ,"~w~GOLFER"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,37    ,2024.8580321545.40661610.820312274.217559    },
{
57    ,"~w~JEWEL THIEF"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,40    ,2024.8580321545.40661610.820312274.217559    },
{
58    ,"~w~DRUG DEALER"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,41    ,2024.8580321545.40661610.820312274.217559    },
{
59    ,"~w~GAMBLER"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,43    ,2024.8580321545.40661610.820312274.217559    },
{
60    ,"~w~PERVET"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,44    ,2024.8580321545.40661610.820312274.217559    },
{
61    ,"~w~LOAN SHARK"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,46    ,2024.8580321545.40661610.820312274.217559    },
{
62    ,"~w~OLD LADY"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,130    ,2024.8580321545.40661610.820312274.217559    },
{
63    ,"~w~OLD HIPPY"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,132    ,2024.8580321545.40661610.820312274.217559    },
{
64    ,"~w~BUSINESS MAN"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,229    ,2024.8580321545.40661610.820312274.217559    },
{
65    ,"~w~MAN WHORE"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,252    ,2024.8580321545.40661610.820312274.217559    },
{
66    ,"~w~BAG LADY"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,77    ,2024.8580321545.40661610.820312274.217559    },
{
67    ,"~w~SLUT"                    ,TEAM_CIVILIAN    ,SKILL_NONE    ,90    ,2024.8580321545.40661610.820312274.217559    },
{
68    ,"~w~RETIRED OLD MAN"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,94    ,2024.8580321545.40661610.820312274.217559    },
{
69    ,"~w~POTHEAD"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,1    ,2024.8580321545.40661610.820312274.217559    },
{
70    ,"~w~STREET RACER"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,2    ,2024.8580321545.40661610.820312274.217559    },
{
71    ,"~w~GANGSTER"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,47    ,2024.8580321545.40661610.820312274.217559    },
{
72    ,"~w~IMMIGRANT"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,48    ,2024.8580321545.40661610.820312274.217559    },
{
73    ,"~w~NICE OLD MAN"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,49    ,2024.8580321545.40661610.820312274.217559    },
{
74    ,"~w~MECHANIC"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,50    ,2024.8580321545.40661610.820312274.217559    },
{
75    ,"~w~PERSONAL TRAINER"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,51    ,2024.8580321545.40661610.820312274.217559    },
{
76    ,"~w~GRANDMA"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,54    ,2024.8580321545.40661610.820312274.217559    },
{
77    ,"~w~GRANDMA"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,39    ,2024.8580321545.40661610.820312274.217559    },
{
78    ,"~w~GANGSTA CHICK"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,56    ,2024.8580321545.40661610.820312274.217559    },
{
79    ,"~w~BUSINESS MAN"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,57    ,2024.8580321545.40661610.820312274.217559    },
{
80    ,"~w~CONVENIANCE STORE~n~CLERK"    ,TEAM_CIVILIAN    ,SKILL_NONE    ,58    ,2024.8580321545.40661610.820312274.217559    },
{
81    ,"~w~MAN WHORE"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,59    ,2024.8580321545.40661610.820312274.217559    },
{
82    ,"~w~STREET RACER"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,60    ,2024.8580321545.40661610.820312274.217559    },
{
83    ,"~w~CRANKY OLD MAN"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,62    ,2024.8580321545.40661610.820312274.217559    },
{
84    ,"~w~CRACK WHORE"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,63    ,2024.8580321545.40661610.820312274.217559    },
{
85    ,"~w~CRACK WHORE"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,64    ,2024.8580321545.40661610.820312274.217559    },
{
86    ,"~w~GANGSTER"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,66    ,2024.8580321545.40661610.820312274.217559    },
{
87    ,"~w~BOUNCER"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,67    ,2024.8580321545.40661610.820312274.217559    },
{
88    ,"~w~PRIEST"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,68    ,2024.8580321545.40661610.820312274.217559    },
{
89    ,"~w~SOCIAL WORKER"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,69    ,2024.8580321545.40661610.820312274.217559    },
{
90    ,"~w~MAD SCIENTIST"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,70    ,2024.8580321545.40661610.820312274.217559    },
{
91    ,"~w~POTHEAD"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,72    ,2024.8580321545.40661610.820312274.217559    },
{
92    ,"~w~HEROIN ADDICT"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,75    ,2024.8580321545.40661610.820312274.217559    },
{
93    ,"~w~CONTRACT KILLER"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,76    ,2024.8580321545.40661610.820312274.217559    },
{
94    ,"~w~HOBO"                    ,TEAM_CIVILIAN    ,SKILL_NONE    ,78    ,2024.8580321545.40661610.820312274.217559    },
{
95    ,"~w~HOBO"                    ,TEAM_CIVILIAN    ,SKILL_NONE    ,79    ,2024.8580321545.40661610.820312274.217559    },
{
96    ,"~w~FAKE ELVIS"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,82    ,2024.8580321545.40661610.820312274.217559    },
{
97    ,"~w~FAKE ELVIS"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,83    ,2024.8580321545.40661610.820312274.217559    },
{
98    ,"~w~FAKE ELVIS"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,84    ,2024.8580321545.40661610.820312274.217559    },
{
99    ,"~w~PRIVATE ESCORT"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,85    ,2024.8580321545.40661610.820312274.217559    },
{
100    ,"~w~STRIPPER"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,87    ,2024.8580321545.40661610.820312274.217559    },
{
101    ,"~w~FRIENDLY GRANDMA"    ,TEAM_CIVILIAN    ,SKILL_NONE    ,88    ,2024.8580321545.40661610.820312274.217559    },
{
102    ,"~w~CRANKY GRANDMA"    ,TEAM_CIVILIAN    ,SKILL_NONE    ,89    ,2024.8580321545.40661610.820312274.217559    },
{
103    ,"~w~PRIVATE ESCORT"    ,TEAM_CIVILIAN    ,SKILL_NONE    ,216    ,2024.8580321545.40661610.820312274.217559    },
{
104    ,"~w~ROLLERSKATE GIRL"    ,TEAM_CIVILIAN    ,SKILL_NONE    ,92    ,2024.8580321545.40661610.820312274.217559    },
{
105    ,"~w~JEWEL THIEF"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,93    ,2024.8580321545.40661610.820312274.217559    },
{
106    ,"~w~MENTALLY ILL"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,95    ,2024.8580321545.40661610.820312274.217559    },
{
107    ,"~w~SPORTS BUFF"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,96    ,2024.8580321545.40661610.820312274.217559    },
{
108    ,"~w~MAN WHORE"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,97    ,2024.8580321545.40661610.820312274.217559    },
{
109    ,"~w~MAN WHORE"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,98    ,2024.8580321545.40661610.820312274.217559    },
{
110    ,"~w~SKATER"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,99    ,2024.8580321545.40661610.820312274.217559    },
{
111    ,"~w~BIKER"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,100    ,2024.8580321545.40661610.820312274.217559    },
{
112    ,"~w~PUSHER"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,101    ,2024.8580321545.40661610.820312274.217559    },
{
113    ,"~w~MAFIA BOSS"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,111    ,2024.8580321545.40661610.820312274.217559    },
{
114    ,"~w~CONTRACT KILLER"    ,TEAM_CIVILIAN    ,SKILL_NONE    ,112    ,2024.8580321545.40661610.820312274.217559    },
{
115    ,"~w~MAFIA HITMAN"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,117    ,2024.8580321545.40661610.820312274.217559    },
{
116    ,"~w~JEWEL THIEF"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,263    ,2024.8580321545.40661610.820312274.217559    },
{
117    ,"~w~PUSHER"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,123    ,2024.8580321545.40661610.820312274.217559    },
{
118    ,"~w~BOUNCER"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,124    ,2024.8580321545.40661610.820312274.217559    },
{
119    ,"~w~BANK ROBBER"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,125    ,2024.8580321545.40661610.820312274.217559    },
{
120    ,"~w~USED CAR SALESMAN"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,126    ,2024.8580321545.40661610.820312274.217559    },
{
121    ,"~w~CONTRACT KILLER"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,127    ,2024.8580321545.40661610.820312274.217559    },
{
122    ,"~w~HERBAL SPECIALIST"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,128    ,2024.8580321545.40661610.820312274.217559    },
{
123    ,"~w~CRAZY OLD BAG"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,129    ,2024.8580321545.40661610.820312274.217559    },
{
124    ,"~w~HERBAL SPECIALIST"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,131    ,2024.8580321545.40661610.820312274.217559    },
{
125    ,"~w~TRUCKER"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,133    ,2024.8580321545.40661610.820312274.217559    },
{
126    ,"~w~MARTIAL ARTS EXPERT"    ,TEAM_CIVILIAN    ,SKILL_NONE    ,203    ,2024.8580321545.40661610.820312274.217559    },
{
127    ,"~w~MARTIAL ARTS EXPERT"    ,TEAM_CIVILIAN    ,SKILL_NONE    ,204    ,2024.8580321545.40661610.820312274.217559    },
{
128    ,"~w~BOXER"                        ,TEAM_CIVILIAN    ,SKILL_NONE    ,80        ,2024.8580321545.40661610.820312274.217559    },
{
129    ,"~w~BOXER"                        ,TEAM_CIVILIAN    ,SKILL_NONE    ,81        ,2024.8580321545.40661610.820312274.217559    },
{
130    ,"~w~WAITER"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,171    ,2024.8580321545.40661610.820312274.217559    },
{
131    ,"~w~WAITRESS"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,11        ,2024.8580321545.40661610.820312274.217559    },
{
132    ,"~w~CONSTRUCTION WORKER"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,27        ,2024.8580321545.40661610.820312274.217559    },
{
133    ,"~w~CONSTRUCTION WORKER"        ,TEAM_CIVILIAN    ,SKILL_NONE    ,260    ,2024.8580321545.40661610.820312274.217559    },
{
134    ,"~w~VALET"                        ,TEAM_CIVILIAN    ,SKILL_NONE    ,189    ,2024.8580321545.40661610.820312274.217559    },
{
135    ,"~w~PIMP"                        ,TEAM_CIVILIAN    ,SKILL_NONE    ,249    ,2024.8580321545.40661610.820312274.217559    },
{
136    ,"~w~PUNK"                        ,TEAM_CIVILIAN    ,SKILL_NONE    ,181    ,2024.8580321545.40661610.820312274.217559    },
{
137    ,"~w~FARMER"                    ,TEAM_CIVILIAN    ,SKILL_NONE    ,161    ,2024.8580321545.40661610.820312274.217559    },
{
138    ,"~w~FARMERS WIFE"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,130    ,2024.8580321545.40661610.820312274.217559    },
{
139    ,"~w~FARMERS DAUGHTER"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,198    ,2024.8580321545.40661610.820312274.217559    },
{
140    ,"~w~STUDENT"                    ,TEAM_CIVILIAN    ,SKILL_NONE    ,193    ,2024.8580321545.40661610.820312274.217559    },
{
141    ,"~w~KITCHEN HAND"                ,TEAM_CIVILIAN    ,SKILL_NONE    ,168    ,2024.8580321545.40661610.820312274.217559    },
{
142    ,"~w~AIRPORT WORKER"            ,TEAM_CIVILIAN    ,SKILL_NONE    ,16        ,2024.8580321545.40661610.820312274.217559    },
{
143    ,"~w~GRANDPA"                    ,TEAM_CIVILIAN    ,SKILL_NONE    ,197    ,2024.8580321545.40661610.820312274.217559    },
{
144    ,"~w~GRANDPA"                    ,TEAM_CIVILIAN    ,SKILL_NONE    ,62        ,2024.8580321545.40661610.820312274.217559    },
{
145    ,"~w~CLOWN"                        ,TEAM_CIVILIAN    ,SKILL_NONE    ,264    ,2024.8580321545.40661610.820312274.217559    },
{
146    ,"~w~BARBER"                    ,TEAM_CIVILIAN    ,SKILL_NONE    ,176        ,2024.8580321545.40661610.820312274.217559    },
{
147    ,"~w~BARBER"                    ,TEAM_CIVILIAN    ,SKILL_NONE    ,177    ,2024.8580321545.40661610.820312274.217559    },
{
148    ,"~w~AFRO"                        ,TEAM_CIVILIAN    ,SKILL_NONE    ,241        ,2024.8580321545.40661610.820312274.217559    },
{
149    ,"~w~MEXICAN"                    ,TEAM_CIVILIAN    ,SKILL_NONE    ,242    ,2024.8580321545.40661610.820312274.217559    },
{
150    ,"~w~MENTALLY ILL"                    ,TEAM_CIVILIAN    ,SKILL_NONE    ,137    ,2024.8580321545.40661610.820312274.217559    }
};
//==============================================================================
new spawned[MAX_PLAYERS];
new 
STATS_SAVE[MAX_PLAYERS];
new 
Text:gTime;
new 
Text:gDay;
new 
gtime=0;
new 
gday=0;
new 
N11=0;
//==============================================================================
main()
{
    print(
"\n----------------------------------");
    print(
" !_ KEvi GAmeMoDe _!");
    print(
"----------------------------------\n");
}
public 
OnGameModeInit()
{
    
SetGameModeText("Cops'n'Robbers");
    
    
// Player Class's
    
for(new 0sizeof(Peds); i++)
    {
    
AddPlayerClassEx(Peds[i][Spawn_TeamId], Peds[i][Spawn_SkinId], Peds[i][Spawn_X], Peds[i][Spawn_Y], Peds[i][Spawn_Z], Peds[i][Spawn_A], 0,00,00,0);
    }
    
    
SetTimer("Timer",MINUTE,1);//
    
    
    
gTime TextDrawCreate(605.000000,25.000000,"00:00");
    
TextDrawAlignment(gTime,3);
    
TextDrawBackgroundColor(gTime,0x000000FF);
    
TextDrawFont(gTime,3);
    
TextDrawLetterSize(gTime,0.535,2.2);
    
TextDrawColor(gTime,COLOR_TIME);
    
TextDrawSetOutline(gTime,2);
    
TextDrawSetProportional(gTime,1);
    
TextDrawSetShadow(gTime,1);
    
gDay TextDrawCreate(610.000000,7.000000,"Sunday");
    
TextDrawUseBox(gDay,0);
    
TextDrawFont(gDay,3);
    
TextDrawLetterSize(gDay,0.5,1.3);
    
TextDrawSetShadow(gDay,1);
    
TextDrawSetOutline(gDay ,0);
    
TextDrawBackgroundColor(gDay0x000000FF);
    
TextDrawBoxColor(gDay ,0x00000066);
    
TextDrawColor(gDay,COLOR_DAY);
    
TextDrawTextSize(gDay , -1880.0, -1880.0);
    
TextDrawAlignment(gDay,3);
    
TextDrawSetOutline(gDay,1);
    return 
1;
}
public 
OnGameModeExit()
{
    for(new 
0MAX_PLAYERSi++)
    {
    
OnSavePlayerStats(i);
    }
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    new 
string[300];
    
       
SetPlayerPosEx(playerid,-78.3052,1385.9991,9.8040281.6389,0,0);
    
SetPlayerCameraPos(playerid,-74.72021387.185110.4307);
    
SetPlayerCameraLookAt(playerid,-75.67651386.877910.4806);
    
    if(
PlayerInfo[playerid][pLogedin] == && PlayerInfo[playerid][pRegistered] == 1)
    {
    if(
fexist(UserPath(playerid)))
    {
        
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
        
format(stringsizeof(string), "{0835C7}TuFF's Cops And Robbers\n \n{146AC7}Player Login\n \n{FFFFFF}This Nick, {146AC7}%s, {FFFFFF}is Registered.\n",GetName(playerid),playerid);
        
strcat(string"If This Is Not Your Account, Please Quit And Change Your Name.\n \nPlease {D6D631}Enter Your Password {FFFFFF}To Login:"sizeof(string));
          
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,"Login"string,"Login","Quit");
  
    }
    else
    {
        
format(stringsizeof(string), "%s",Peds[classid][Class_Name]);
        
GameTextForPlayer(playerid,string3000,3);
        
        
PlayerInfo[playerid][pClass] = GetPlayerSkin(playerid);
        
PlayerInfo[playerid][pTeam] = Peds[classid][Spawn_TeamId];
        
PlayerInfo[playerid][pSkill] = Peds[classid][Spawn_SkillId];
    }
    
    }
    if(
PlayerInfo[playerid][pLogedin] == && PlayerInfo[playerid][pRegistered] == 1)
    {
        
classid PlayerInfo[playerid][pClass];
    }
    
    if(
PlayerInfo[playerid][pLogedin] == && PlayerInfo[playerid][pRegistered] == 0)
    {
        
format(stringsizeof(string), "%s",Peds[classid][Class_Name]);
        
GameTextForPlayer(playerid,string3000,3);
        
PlayerInfo[playerid][pClass] = classid;
        
PlayerInfo[playerid][pTeam] = Peds[classid][Spawn_TeamId];
        
PlayerInfo[playerid][pSkill] = Peds[classid][Spawn_SkillId];
    }
    
    
SetPlayerSkin(playerid,Peds[classid][Spawn_SkinId]);
    
SetSpawnInfo(playerid,Peds[classid][Spawn_TeamId], Peds[classid][Spawn_SkinId], Peds[classid][Spawn_X], Peds[classid][Spawn_Y], Peds[classid][Spawn_Z], Peds[classid][Spawn_A], 0,00,00,0);
    
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
spawned[playerid] = 0;
    
PlayerInfo[playerid][pLogedin] = 0;
    
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    
INI_WriteInt(File,"Registered",PlayerInfo[playerid][pRegistered]);
    
INI_WriteInt(File,"Class",PlayerInfo[playerid][pClass]);
    
INI_WriteInt(File,"Skill",PlayerInfo[playerid][pSkill]);
    
INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
    
INI_Close(File);
    
    
KillTimer(STATS_SAVE[playerid]);
    
    if(
PlayerInfo[playerid][pRegistered] == 1)
    {
    
PlayerInfo[playerid][pRegistered] = 1;
    }
    else
    {
    
PlayerInfo[playerid][pRegistered] = 0;
    }
 
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    
spawned[playerid] = 1;
    
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    
PlayerInfo[killerid][pKills]++;
    
PlayerInfo[playerid][pDeaths]++;
    
    
spawned[playerid] = 0;
    return 
1;
}
public 
OnVehicleSpawn(vehicleid)
{
    return 
1;
}
public 
OnVehicleDeath(vehicleidkillerid)
{
    return 
1;
}
public 
OnPlayerText(playeridtext[])
{
    return 
1;
}
//========================================CMD===================================
CMD:register(playeridparams[])
{
    new 
string[300];
    if(
spawned[playerid] ==0)return SendClientMessage(playeridCOLOR_RED,"You Must Be Spawned To Use This Command.");
    
    if(
fexist(UserPath(playerid)))
    {
        
SendClientMessage(playeridCOLOR_RED,"You Already Registered.");
    }
    else
    {
         
         
format(stringsizeof(string), "Cops And Robbers\n \nNew Registration - Name: %s\n \nDo Not Register Multiple Accounts\nDo Not Use The Same Password That You Use Elsewhere\nMinimum 6 Chars Maximum 12 Chars\n \nPlease Enter A Password For Your Account:",GetName(playerid),playerid);
        
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT "CnR Registration",string"Register""Cancel");
        
    }
    return 
1;
}
//==============================================================================
CMD:settime(playerid,params[])
{
    new 
string[128];
    new 
N1,N2;
    new 
pname[24];
    
GetPlayerName(playerid,pname,sizeof(pname));
    if(!
IsPlayerAdmin(playerid))
    {
        
SendClientMessage(playerid,COLOR_RED,""ERROR_MSG"");
        return 
1;
    }
    if(
sscanf(params"ii"N1,N2))
    {
        
SendClientMessage(playerid,COLOR_RED,"USAGE: /settime (Hour) (Minute)");
        return 
1;
    }
    if(
N1 || N1 23)
    {
        
SendClientMessage(playerid,COLOR_RED,"Please enter an amount between 0 and 23.");
        return 
1;
    }
    if(
N2 || N2 59)
    {
        
SendClientMessage(playerid,COLOR_RED,"Please enter an amount between 0 and 59.");
        return 
1;
    }
    
N11N1 60;
    
gtime=N11 N2;
    
format(string,sizeof(string),"%s(%d) has changed the time to %02d:%02d!",pname,playerid,N1,N2);
    
SendClientMessageToAll(COLOR_YELLOW,string);
    return 
1;
}
//==============================================================================
CMD:setday(playerid,params[])
{
    new 
string[128];
    new 
N1;
    new 
pname[24];
    
GetPlayerName(playerid,pname,sizeof(pname));
    if(!
IsPlayerAdmin(playerid))
    {
        
SendClientMessage(playerid,COLOR_RED,""ERROR_MSG"");
        return 
1;
    }
    if(
sscanf(params"i"N1))
    {
        
SendClientMessage(playerid,COLOR_RED,"USAGE: /setday (Day)");
        return 
1;
    }
    if(
N1 || N1 6)
    {
        
SendClientMessage(playerid,COLOR_RED,"Please enter an amount between 0 and 6.");
        return 
1;
    }
    
gday=N1;
    
format(string,sizeof(string),"%s(%d) has changed the day to %s!",pname,playerid,GetDayName());
    
SendClientMessageToAll(COLOR_YELLOW,string);
    return 
1;
}
//==============================================================================
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    return 
1;
}
public 
OnPlayerExitVehicle(playeridvehicleid)
{
    return 
1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    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(playeridobjectid)
{
    return 
1;
}
public 
OnPlayerPickUpPickup(playeridpickupid)
{
    return 
1;
}
public 
OnVehicleMod(playeridvehicleidcomponentid)
{
    return 
1;
}
public 
OnVehiclePaintjob(playeridvehicleidpaintjobid)
{
    return 
1;
}
public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
    return 
1;
}
public 
OnPlayerSelectedMenuRow(playeridrow)
{
    return 
1;
}
public 
OnPlayerExitedMenu(playerid)
{
    return 
1;
}
public 
OnPlayerInteriorChange(playeridnewinterioridoldinteriorid)
{
    return 
1;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    return 
1;
}
public 
OnRconLoginAttempt(ip[], password[], success)
{
    return 
1;
}
public 
OnPlayerUpdate(playerid)
{
    return 
1;
}
public 
OnPlayerStreamIn(playeridforplayerid)
{
    return 
1;
}
public 
OnPlayerStreamOut(playeridforplayerid)
{
    return 
1;
}
public 
OnVehicleStreamIn(vehicleidforplayerid)
{
    return 
1;
}
public 
OnVehicleStreamOut(vehicleidforplayerid)
{
    return 
1;
}
public 
OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if(!
success) return SendClientMessage(playeridCOLOR_RED"Unknown Command! Type /cmds For Available Commands.");
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    new 
string[300];
    switch( 
dialogid )
    {
        case 
DIALOG_REGISTER:
        {
            if (!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                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,"Admin",0);
                
INI_WriteInt(File,"Kills",0);
                
INI_WriteInt(File,"Deaths",0);
                
INI_Close(File);
                
STATS_SAVE[playerid] = SetTimerEx("AUTO_SAVE"50001"i"playerid);
                
                
SendClientMessage(playeridCOLOR_LIGHTBLUE"You Sucesfully Register On TuFF's Cops And Robbers!");
                
PlayerInfo[playerid][pRegistered] = 1;
            }
        }
        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);
                    
GivePlayerMoney(playeridPlayerInfo[playerid][pCash]);
                    
                    
PlayerInfo[playerid][pLogedin] = 1;
                    
                    new 
classid PlayerInfo[playerid][pClass];
                    
OnPlayerRequestClass(playeridclassid);
                    
                    
STATS_SAVE[playerid] = SetTimerEx("AUTO_SAVE"400001"i"playerid);
                    
                    if(
PlayerInfo[playerid][pAdmin] > 0)
                    {
                    
format(stringsizeof(string), "Logged In As Level %i {FF0000}Admin.",PlayerInfo[playerid][pAdmin]);
                       
SendClientMessage(playerid, -1string);
                    }else{
                    
SendClientMessage(playerid, -1"Logged In As {00CED1}Registered Player.");
                    }
                }
                else
                {
                
                    
format(stringsizeof(string), "CnR\n \nThe Name, %s, is Registered.\nIf this is not your account, please quit and change your name.\n \nPlease Enter Your Password To Login:",GetName(playerid),playerid);
                    
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT "CnR Login"string"Login""Cancel");
                    
                    
SendClientMessage(playeridCOLOR_RED"Incorrect Password");
                      
SendClientMessage(playeridCOLOR_LIGHTBLUE"Please Re-Enter Your Password.");
                    
SetPVarInt(playerid"WrongPass"GetPVarInt(playerid"WrongPass") + 1);
                    
                    if(
GetPVarInt(playerid"WrongPass") == 3)
                    {
                    
KickPlayer(playerid,"Server","INVALID LOGIN","Too Many Failed Login's!");
                    }
                }
                return 
1;
            }
        }
    }
    return 
1;
}
public 
OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    return 
1;
}
//==============================================================================
forward LoadUser_data(playerid,name[],value[]);
public 
LoadUser_data(playerid,name[],value[])
{
    
INI_Int("Password",PlayerInfo[playerid][pPass]);
    
INI_Int("Cash",PlayerInfo[playerid][pCash]);
    
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    
INI_Int("Kills",PlayerInfo[playerid][pKills]);
    
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    
INI_Int("Registered",PlayerInfo[playerid][pRegistered]);
    
INI_Int("Class",PlayerInfo[playerid][pClass]);
    
INI_Int("Skill",PlayerInfo[playerid][pSkill]);
    
INI_Int("Team",PlayerInfo[playerid][pTeam]);
    
     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;
}
//==============================================================================
stock udb_hash(buf[]) {
    new 
length=strlen(buf);
    new 
s1 1;
    new 
s2 0;
    new 
n;
    for (
n=0n<lengthn++)
    {
       
s1 = (s1 buf[n]) % 65521;
       
s2 = (s2 s1)     % 65521;
    }
    return (
s2 << 16) + s1;
}
//===========================================================
stock GetName(playerid)
{
        new 
pName[MAX_PLAYER_NAME];
        
GetPlayerName(playeridpNamesizeof(pName));
        return 
pName;
}
//==============================================================================
stock KickPlayer(playerid,KickerName[],KickerDisplayName[],Reason[])
{
    new 
string[256];
    
format(stringsizeof(string), "**%s KICK: %s (%i) REASON: {FFFFFF}%s",KickerDisplayName,GetName(playerid),playerid,Reason);
    
SendClientMessageToAll(COLOR_ADMINstring);
    
format(stringsizeof(string), "[KICK] %s BY: %s REASON: %s",GetName(playerid),KickerName,Reason);
     
SendToAdmins(COLOR_ADMIN,string);
    
Kick(playerid);
    return 
1;
}
//==============================================================================
stock SendToAdmins(const color, const message[])
{
    for(new 
0MAX_PLAYERSi++)
        if(
PlayerInfo[i][pAdmin] > 1)
            
SendClientMessage(icolormessage);
    return 
1;
}
//==============================================================================
stock SetPlayerPosEx(playerid,Float:x,Float:y,Float:z,Float:angle,interior,world)
{
    
SetPlayerPos(playerid,x,y,z);
    
SetPlayerFacingAngle(playerid,angle);
    
SetPlayerInterior(playerid,interior);
    
SetPlayerVirtualWorld(playerid,world);
    
SetCameraBehindPlayer(playerid);
    return 
1;
}
//==============================================================================
stock GetDayName()
{
    new 
DayName[128];
    switch(
gday)
    {
        case 
0format(DayNamesizeof(DayName), "Sunday");
        case 
1format(DayNamesizeof(DayName), "Monday");
        case 
2format(DayNamesizeof(DayName), "Tuesday");
        case 
3format(DayNamesizeof(DayName), "Wednesday");
        case 
4format(DayNamesizeof(DayName), "Thursday");
        case 
5format(DayNamesizeof(DayName), "Friday");
        case 
6format(DayNamesizeof(DayName), "Saturday");
    }
    return 
DayName;
}
//==============================================================================
forward Timer();
public 
Timer()
{
     new 
timestring[256];
      new 
daystring[256];
    new 
gseconds gtime 60,
    
gminutes = (gtime gseconds) / 60;
    
gtime ++;
    
format(timestringsizeof (timestring), "   %02d:%02d"gminutesgseconds);
    
TextDrawSetString(gTime,timestring);
    
TextDrawShowForAll(gTime);
    
format(daystringsizeof (daystring), "%s",GetDayName());
    
TextDrawSetString(gDay,daystring);
    
TextDrawShowForAll(gDay);
    if(
gday==6&&gtime==1440)//One week passed
    
{
              
gday=0;
              
gtime=0;
    }
    if(
gtime==1440)//One day passed
    
{
        
gday++;
        
gtime=0;
        
format(daystringsizeof (daystring), "   00:00");
        
TextDrawSetString(gTime,daystring);
    }
    for(new 
i=0i<MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            
SetPlayerTimeigminutesgseconds);
        }
    }
    return 
1;
}
//==============================================================================
stock OnSavePlayerStats(playerid)
{
    
SendClientMessage(playerid, -1,"Je Njesh");
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    
INI_WriteInt(File,"Registered",PlayerInfo[playerid][pRegistered]);
    
INI_WriteInt(File,"Class",PlayerInfo[playerid][pClass]);
    
INI_WriteInt(File,"Skill",PlayerInfo[playerid][pSkill]);
    
INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
    
INI_Close(File);
}
forward AUTO_SAVE(playerid);
public 
AUTO_SAVE(playerid)
{
    if(
PlayerInfo[playerid][pLogedin] == && spawned[playerid] == 1)
    {
    
OnSavePlayerStats(playerid);
    }
    return 
1;

This is my code PLEASE help!
Reply
#8

in this
PHP код:
forward LoadUser_data(playerid,name[],value[]);
public 
LoadUser_data(playerid,name[],value[])
{
    
INI_Int("Password",pInfo[playerid][pPass]);
    
INI_Int("Cash",pInfo[playerid][pCash]);
    
INI_Int("Admin",pInfo[playerid][pAdmin]);
    
INI_Int("Kills",pInfo[playerid][pKills]);
    
INI_Int("Deaths",pInfo[playerid][pDeaths]);
    
INI_Close(File);
     return 
1;

and Done
Reply
#9

sorry Loinal i got this error

PHP код:

C
:\Users\User\Desktop\ALAKAZAM\gamemodes\cnr.pwn(735) : error 017undefined symbol "File"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
1 Error

Line 735
INI_Close(File);
Reply
#10

add

PHP код:
new File
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)