Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define DIALOG_ID_SKIN_SELECTION 2
- #define MAX_SKIN_NAME 32
- enum skin_layout
- {
- skinID,
- skinPrice,
- skinWeapon,
- skinAmmo,
- skinName[MAX_SKIN_NAME],
- };
- new listitems[][skin_layout] =
- {
- {120, 1337, 23, 500, "Man skin"},
- {93, 1500, 23, 500, "Girl skin"},
- {113, 1500, 23, 500, "Maffia skin"},
- {59, 1500, 23, 500, "Man skin"}
- };
- main()
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp(cmdtext, "/riided", true) == 0)
- {
- new fullstr[200]; // change accordingly. the more items you have in your array the longer this str should be, you can eventually count how long you need this one to be
- new tmpstr[64];
- for(new l = 0; l < sizeof listitems; l++)
- {
- format(tmpstr, sizeof tmpstr, "Name: %s\t\tCosts: %d\n", listitems[l][skinName], listitems[l][skinPrice]);
- strcat(fullstr, tmpstr);
- }
- ShowPlayerDialog(playerid, DIALOG_ID_SKIN_SELECTION, DIALOG_STYLE_LIST, "Riided", fullstr, "I like!", "Cancel");
- return 1;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- new str[128];
- if(dialogid == DIALOG_ID_SKIN_SELECTION)
- {
- if(response)
- {
- SafeGivePlayerMoney(playerid, -listitems[listitem][skinPrice]);
- GivePlayerWeapon(playerid, listitems[listitem][skinWeapon], listitems[listitem][skinAmmo]);
- SetPlayerSkin(playerid, listitems[listitem][skinID]);
- format(str, sizeof str, "Item costed: $%d", listitems[listitem][skinPrice]);
- SendClientMessage(playerid, COLOR_WHITE, str);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment