15.02.2013, 12:39
hi i used DOF2 for my register system and i really dont know how to save pos in that and load it when player log on..thx for all answers
/******************************************************************************/ #include <a_samp> /******************************************************************************/ #include Double-O-Seven/Double-O-Files-2.inc /******************************************************************************/ #define AC Ucet(playerid) #define ForeachDialogId switch(dialogid) #define DIALOG_INFO 0 #define DIALOG_REGISTER 10000 #define DIALOG_LOGIN 10001 #define DIALOG_UCET 10002 #define DIALOG_ZMENA_IP 10003 #define DIALOG_ZMENA_HESLA 10004 #define DIALOG_DELETE_ACC 10005 #define DIALOG_DELETE_REALLY_CONFIRM 10006 /******************************************************************************/ main() { print("\n----------------------------------"); print(" Double-O-Files-2 Maximum Register Script"); print("----------------------------------\n"); } /******************************************************************************/ public OnFilterScriptExit() { DOF2_Exit(); return 1; } /******************************************************************************/ public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerSkin(playerid,DOF2_GetInt(AC,"Skin")); return 1; } /******************************************************************************/ stock Ucet(playerid) { new str[256],name[21]; GetPlayerName(playerid,name,21); format(str,256,"Ucty/%s.ini",name); return str; } /******************************************************************************/ public OnPlayerConnect(playerid) { if(!DOF2_FileExists(AC)) { ShowPlayerDialog(playerid,DIALOG_REGISTER,3,"{FFFFFF}Ъčet - Registrace","{FFFFFF}Vнtej na serveru {0000FF}XY.\nPro hranн je {FF0000}vyћadovбna {FFFFFF}registrace.\nProsнme {FF0000}zaregistrujte{FFFFFF} se.\n\n","Dбle","Odejнt"); }else{ new IP[16]; GetPlayerIp(playerid,IP,16); if(strmatch(IP,DOF2_GetString(AC,"IP Adresa"))) { LoadPlayerAccount(playerid); }else{ ShowPlayerDialog(playerid,DIALOG_LOGIN,3,"{FFFFFF}Ъčet - Přihlбљenн","{FFFFFF}Vнtej zpět.\nBohuћel se tvб nynějљн IP {FF0000}neshoduje{FFFFFF} s registračnн.\nProsнm ověř svoji totoћnost heslem.\n\n","Dбle","Odejнt"); } } return 1; } /******************************************************************************/ public OnPlayerDisconnect(playerid, reason) { DOF2_SetInt(AC,"Penнze",GetPlayerMoney(playerid),"Player Info"); DOF2_SetInt(AC,"Skin",GetPlayerSkin(playerid),"Player Info"); DOF2_SaveFile(); return 1; } /******************************************************************************/ public OnPlayerSpawn(playerid) { return 1; } /******************************************************************************/ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { ForeachDialogId { /**********************************************************************/ case DIALOG_REGISTER: { if(response) { if(!strlen(inputtext))return SendClientMessage(playerid,-1,"{FF0000}[Registrace] {FFFFFF}Nezadal jsi {FF0000}ћбdnй{FFFFFF} heslo!!"); DOF2_CreateFile(AC,inputtext); new IP[16]; GetPlayerIp(playerid,IP,16); DOF2_SetString(AC,"IP Adresa",IP,"Account_Info"); DOF2_SaveFile(); } else if(!response) { KickEx(playerid,"Odmнtl registraci"); } } /**********************************************************************/ case DIALOG_LOGIN: { if(response) { if(!strlen(inputtext))return SendClientMessage(playerid,-1,"{FF0000}[Přihlбљenн] {FFFFFF}Nezadal jsi {FF0000}ћбdnй{FFFFFF} heslo!!"); if(DOF2_CheckLogin(AC,inputtext)) { LoadPlayerAccount(playerid); }else{ ShowPlayerDialog(playerid,DIALOG_LOGIN,3,"{FFFFFF}Ъčet - Přihlбљenн","{FFFFFF}Je nбm lнto ale bohuћel jsi zadal {FF0000}nesprбvnй {FFFFFF}heslo.\nZkus to prosнm znovu.\n\n","Dбle","Odejнt"); } } else if(!response) { KickEx(playerid,"Odmнtl přihlбљenн"); } } /**********************************************************************/ case DIALOG_UCET: { if(response) { if(listitem == 0)//změna ip { ShowPlayerDialog(playerid,DIALOG_ZMENA_IP,0,"{FFFFFF}Ъčet - Změna IP","{FFFFFF}Opravdu chceљ změnit ip adresu přiřazenou tomuto ъčtu?\n\n","Ano","Ne"); } if(listitem == 1)//změna hesla { ShowPlayerDialog(playerid,DIALOG_ZMENA_HESLA,1,"{FFFFFF}Ъčet - Změna Hesla","{FFFFFF}Zapiљ novй heslo do rбmečku pod textem.\n\n","Změnit","Odejнt"); } if(listitem == 2)//vymazat učet { ShowPlayerDialog(playerid,DIALOG_DELETE_ACC,0,"{FFFFFF}Ъčet - Smazбnн","{FFFFFF}Opravdu chceљ smazat tento ъčet?\n\n","Ano","Ne"); } } } /**********************************************************************/ case DIALOG_ZMENA_IP: { if(response) { new IP[16]; GetPlayerIp(playerid,IP,16); DOF2_SetString(AC,"IP Adresa",IP,"Account_Info"); ShowPlayerDialog(playerid,DIALOG_INFO,0,"{FFFFFF}Ъčet - Změna IP","{00FF00}Ъspěљně {FFFFFF}změněno.","Zavřнt",""); } } /**********************************************************************/ case DIALOG_ZMENA_HESLA: { if(response) { DOF2_SetInt(AC,"Heslo",DOF2_bernstein(inputtext),"Account_Info"); ShowPlayerDialog(playerid,DIALOG_INFO,0,"{FFFFFF}Ъčet - Změna Hesla","{00FF00}Ъspěљně {FFFFFF}změněno.","Zavřнt",""); } } /**********************************************************************/ case DIALOG_DELETE_ACC: { if(response) { ShowPlayerDialog(playerid,DIALOG_DELETE_REALLY_CONFIRM,1,"{FFFFFF}Ъčet - Smazбnн","Pokud opravdu chcete smazat ъčet zadejte heslo do rбmečku nнћe.\n\n","Smazat","Odejнt"); } } /**********************************************************************/ case DIALOG_DELETE_REALLY_CONFIRM: { if(response) { if(DOF2_CheckLogin(AC,inputtext)) { DOF2_RemoveFile(AC); KickEx(playerid,"Smazбnн ъčtu"); } } } /**********************************************************************/ } return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/ucet", cmdtext, true, 10) == 0) { ShowPlayerDialog(playerid,DIALOG_UCET,2,"{FFFFFF}Ъčet - Nastavenн","{FFFFFF}Změna IP\nZměna Hesla\n{FF0000}Vymazat ъčet","Zvolit","Odejнt"); return 1; } return 0; } /******************************************************************************/ stock LoadPlayerAccount(playerid) { GivePlayerMoney(playerid,DOF2_GetInt(AC,"Penнze")); new string[300]; format(string,300,"{FFFFFF}Vнtej...\nЪčet {00FF00}ъspěљně načten{FFFFFF}.\n"); return ShowPlayerDialog(playerid,DIALOG_INFO,0,"Vнtej zpět.",string,"Zavřнt",""); } /******************************************************************************/ stock KickEx(playerid,reason[]) { new string[128],name[21],dologu[128]; GetPlayerName(playerid,name,21); format(string,128,"[Server] {FFFFFF}Byl jsi vyhozen ze serveru z důvodu {FF0000}%s{FFFFFF}.",reason); format(dologu,128,"[Server] {FFFFFF}Hrбč {FF0000}%s {FFFFFF}byl vyhozen ze serveru z důvodu {FF0000}%s{FFFFFF}.",name,reason); printf("[Server] Hrбč %s byl vyhozen ze serveru z důvodu %s",name,reason); SendClientMessageToAllEx(0xFF0000FF,dologu,playerid); SendClientMessage(playerid,0xFF0000FF,string); Kick(playerid); } /******************************************************************************/ stock SendClientMessageToAllEx( color, string[], exeptionid ) { if ( !strlen( string ) ) return 0; for ( new i = 0, j = GetMaxPlayers(); i < j; i ++ ) { if ( !IsPlayerConnected( i ) || ( i == exeptionid ) ) continue; SendClientMessage( i, color, string ); } return 1; } /******************************************************************************/ stock strmatch(const String1[], const String2[]) { if ((strcmp(String1, String2, true, strlen(String2)) == 0) && (strlen(String2) == strlen(String1))) { return true; } else { return false; } } /******************************************************************************/