Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <Double-O-Files>
- #include <dutils>
- #define Dialog_Main 117
- #define Dialog_Edit 217
- enum DLx
- {
- Txt[30]
- };
- new DLv[][DLx] =
- {
- {"Name"},
- {"Skype"},
- {"City"},
- {"Age"},
- {"Facebook"},
- {"Forum"},
- {"Cellphone"}
- };
- public OnPlayerConnect(playerid)
- {
- if(!DOF2_FileExists(pFile(playerid)))
- {
- DOF2_CreateFile(pFile(playerid));
- for(new i; i<sizeof(DLv); i++)
- {
- DOF2_SetString(pFile(playerid), DLv[i][Txt], "Null.");
- }
- DOF2_SaveFile();
- }
- for(new i; i<sizeof(DLv); i++)
- {
- SetPVarString(playerid, DLv[i][Txt], DOF2_GetString(pFile(playerid), DLv[i][Txt]));
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256];
- new tmp[256];
- new idx;
- cmd = strtok(cmdtext, idx);
- if(!strcmp(cmd, "/Details", true))
- {
- tmp = strtok(cmdtext, idx);
- new id;
- id = strval(tmp);
- if(!strlen(tmp) || id == playerid)
- {
- id = playerid;
- }
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Invalid Player ID");
- new DStr[1024];
- new title[70];
- /* if(GetPVarInt(playerid, "HaveCar") != -1)
- {
- //new str[100];
- //GetPVarString(playerid, "CarModel", str, 100);
- format(DStr, sizeof(DStr), "{00FFFF}Vehicle: %d", GetPVarInt(playerid, "HaveCar"));
- if(GetPVarInt(playerid, "sCar") == 1)
- {
- format(DStr, sizeof(DStr), "{00FFFF}Vehicle: %d [[ {FF00FF}Special Car {00FFFFF}]]", GetPVarInt(playerid, "HaveCar"));
- }
- }
- if(GetPVarInt(playerid, "HaveCar") == 0)
- {
- format(DStr, sizeof(DStr), "");
- }*/
- for(new i; i < sizeof(DLv); i++)
- {
- new sxp[100];
- GetPVarString(id, DLv[i][Txt], sxp, 100);
- format(DStr, sizeof(DStr), "%s\n{FFFFFF} [[ %d ]] {00FF00}%s: {FFFFFF}%s", DStr, i, DLv[i][Txt], sxp);
- }
- format(title, sizeof(title), "{00FF00}Details Of: {FFFFFF}%s", GetName(id));
- if(!strlen(tmp) || id == playerid)
- {
- ShowPlayerDialog(playerid, Dialog_Main, DIALOG_STYLE_INPUT, title, DStr, "Edit", "Exit");
- SetPVarInt(playerid, "PTE", playerid);
- }
- else
- {
- ShowPlayerDialog(playerid, Dialog_Main, DIALOG_STYLE_MSGBOX, title, DStr, "OK", "");
- SetPVarInt(playerid, "PTE", id);
- }
- return 1;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == Dialog_Main && response)
- {
- SetPVarInt(playerid, "DTE", strval(inputtext));
- new Str[100];
- format(Str, sizeof(Str), "{FFFFFF} [[ %d ]] {00FF00}%s:", strval(inputtext), DLv[strval(inputtext)][Txt]);
- ShowPlayerDialog(playerid, Dialog_Edit, DIALOG_STYLE_INPUT, "{FF0000}Details {FFFFFF}Edit Mode", Str, "OK", "Cancel");
- }
- if(dialogid == Dialog_Edit && response && GetPVarInt(playerid, "PTE") == playerid)
- {
- SetPVarString(playerid, DLv[GetPVarInt(playerid, "DTE")][Txt], inputtext);
- DOF2_SetString(pFile(playerid), DLv[GetPVarInt(playerid, "DTE")][Txt], inputtext);
- DOF2_SaveFile();
- OnPlayerCommandText(playerid, "/Details");
- }
- return 0;
- }
- stock GetName(playerid)
- {
- new str[24];
- GetPlayerName(playerid, str, 24);
- return str;
- }
- stock pFile(playerid)
- {
- new str[100];
- format(str, sizeof(str), "ProDucK/%s.ini", GetName(playerid));
- return str;
- }
Add Comment
Please, Sign In to add comment