11.12.2012, 13:17
pawn Код:
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, ""LIGHTBLAUW"Registeren",""ROOD"Je hebt de foude wachtwoord in getypt!\n"WIT"Type jouw eigen wachtwoord om te registeren!","Registerr","Verlaat");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Geld",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Moorden",0);
INI_WriteInt(File,"Score",10);
INI_WriteInt(File,"Doden",0);
INI_WriteInt(File,"Bommen",0);
INI_WriteInt(File,"Level",1);
INI_WriteInt(File,"Vip",0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""WIT"Success!",""GROEN"Je bent succesvol registeert","Oke","");
}
}
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(playerid, PlayerInfo[playerid][pGeld]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""GROEN"Sucess!",""GROEN"je bent succesvol ingelogt.","Oke","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WIT"Login",""ROOD"Je hebt de foude wachtwoord in gevuld!\n"WIT"Type je wachtwoord om in teloggen","Login","Verlaat");
}
return 1;
}
}
}
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Geld",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Moorden",PlayerInfo[playerid][pMoorden]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"Doden",PlayerInfo[playerid][pDoden]);
INI_WriteInt(File,"Bommen",PlayerInfo[playerid][pBommen]);
INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
INI_WriteInt(File,"Vip",PlayerInfo[playerid][pVip]);
INI_Close(File);
new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
switch(reason)
{
case 0: format(string, sizeof(string), "%s heeft de server verlaten.(Timeout/Crash)", pname);
case 1: format(string, sizeof(string), "%s heeft de server verlaten. (Leaving)", pname);
case 2: format(string, sizeof(string), "%s heeft de server verlaten. (Kicked/Banned)", pname);
}
SendClientMessageToAll(0x00ff94ff, string);
return 1;
}
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Geld",PlayerInfo[playerid][pGeld]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Moorden",PlayerInfo[playerid][pMoorden]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
INI_Int("Doden",PlayerInfo[playerid][pDoden]);
INI_Int("Bommen",PlayerInfo[playerid][pBommen]);
INI_Int("Level",PlayerInfo[playerid][pLevel]);
INI_Int("Vips",PlayerInfo[playerid][pVip]);
return 1;
}