Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include a_samp
- #include foreach
- #include zcmd
- new PlayerItem[MAX_PLAYERS], CompleteLoop[MAX_PLAYERS];
- CMD:properties(playerid, params[])
- {
- new string[128], cstring[128 * 10]/* | cause we wanna show 10 items so * 10 | */, cnt = 0;
- foreach(new i : Player)
- {
- if(cnt > 9)
- {
- strcat(cstring, "Next\n");
- break;
- }
- else
- {
- if(pOwns(playerid, i))
- {
- new diff_secs = ( pInfo[i][PropertyExpire] - gettime() );
- new remain_months = ( diff_secs / (60 * 60 * 24 * 30) );
- diff_secs -= remain_months * 60 * 60 * 24 * 30;
- new remain_days = ( diff_secs / (60 * 60 * 24) );
- diff_secs -= remain_days * 60 * 60 * 24;
- new remain_hours = ( diff_secs / (60 * 60) );
- diff_secs -= remain_hours * 60 * 60;
- new remain_minutes = ( diff_secs / 60 );
- format(string, sizeof(string), "{FFFFFF}Property: {00FF00}%s {FFFFFF}Location: {00FF00}%s (%d months %d days %d hours %d minutes)\n", pInfo[i][prName], GetZoneName(pInfo[i][PropertyX], pInfo[i][PropertyY], pInfo[i][PropertyZ]),
- remain_months, remain_days, remain_hours, remain_minutes);
- strcat(cstring, string);
- cnt++;
- CompleteLoop[playerid] = cnt;
- PlayerItem[playerid] = cnt;
- }
- }
- }
- if(cnt == 0) ShowPlayerDialog(playerid, WARN, DIALOG_STYLE_MSGBOX, "Properties", "{FF0000}No properties found", "Close", "");
- else ShowPlayerDialog(playerid, DIALOG_PROPERTIES, DIALOG_STYLE_LIST, "Properties", cstring, "Close", "");
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_PROPERTIES)
- {
- if(listitem == PlayerItem[playerid])
- {
- if(strfind(inputtext, "Back", true, 0) != -1))
- {
- cmd_properties(playerid, "");
- }
- else
- {
- new string[128], cstring[128 * 10]/* | cause we wanna show 10 items so * 10 | */, cnt = 0;
- foreach(new i : Player)
- {
- if(cnt == 0)
- {
- i = CompleteLoop[playerid];
- }
- if(cnt > 9)
- {
- strcat(cstring, "Next\n");
- break;
- }
- else
- {
- if(pOwns(playerid, i))
- {
- new diff_secs = ( pInfo[i][PropertyExpire] - gettime() );
- new remain_months = ( diff_secs / (60 * 60 * 24 * 30) );
- diff_secs -= remain_months * 60 * 60 * 24 * 30;
- new remain_days = ( diff_secs / (60 * 60 * 24) );
- diff_secs -= remain_days * 60 * 60 * 24;
- new remain_hours = ( diff_secs / (60 * 60) );
- diff_secs -= remain_hours * 60 * 60;
- new remain_minutes = ( diff_secs / 60 );
- format(string, sizeof(string), "{FFFFFF}Property: {00FF00}%s {FFFFFF}Location: {00FF00}%s (%d months %d days %d hours %d minutes)\n", pInfo[i][prName], GetZoneName(pInfo[i][PropertyX], pInfo[i][PropertyY], pInfo[i][PropertyZ]),
- remain_months, remain_days, remain_hours, remain_minutes);
- strcat(cstring, string);
- cnt++;
- CompleteLoop[playerid] += cnt;
- PlayerItem[playerid] = cnt;
- }
- }
- }
- if(cnt <= 9)
- {
- strcat(cstring, "Back\n");
- }
- if(cnt == 0) ShowPlayerDialog(playerid, WARN, DIALOG_STYLE_MSGBOX, "Properties", "{FF0000}No properties found", "Close", "");
- else ShowPlayerDialog(playerid, DIALOG_PROPERTIES, DIALOG_STYLE_LIST, "Properties", cstring, "Close", "");
- }
- }
- else
- {
- // Property chose
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement