Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <dini>
- #include <zcmd>
- new selectedwatchslot[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- CreatePickup(1239, 1, 1471.2572,-1770.7183,18.7958, -1);
- Create3DTextLabel("((/buywatch))", 0x008080FF, 1471.2572,-1770.7183,19.5958, 40.0, 0, 0);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- printf("debug");
- SetPlayerPos(playerid,1471.2572,-1770.7183,19.7958);
- new file[56];
- format(file,sizeof(file),"watches/%s.txt",PlayerName(playerid));
- if(!dini_Exists(file))
- {
- dini_Create(file);
- dini_IntSet(file,"watch0",0);
- dini_Set(file,"watchname0","None");
- dini_IntSet(file,"watch1",0);
- dini_Set(file,"watchname1","None");
- dini_IntSet(file,"watch2",0);
- dini_Set(file,"watchname2","None");
- dini_IntSet(file,"watch3",0);
- dini_Set(file,"watchname3","None");
- dini_IntSet(file,"watch4",0);
- dini_Set(file,"watchname4","None");
- return 1;
- }
- return 1;
- }
- CMD:buywatch(playerid,params[])
- {
- if(IsPlayerInRangeOfPoint(playerid, 3.0, 1471.2572,-1770.7183,18.7958))
- {
- ShowPlayerDialog(playerid,457,DIALOG_STYLE_LIST,"Watches (20k)","Gold Watch\nSilver Watch\nBronze Watch\nRed Watch\nGreen Watch\nBlue Watch\nFunky Watch","Buy","Cancel");
- return 1;
- }
- else
- {
- SetPlayerCheckpoint(playerid, 1471.2572,-1770.7183,18.7958, 1.0);
- SendClientMessage(playerid,0xFFFFFFFF,"You need to go at the watch shop at Mall.");
- return 1;
- }
- }
- CMD:watch(playerid, params[])
- {
- new file[56];
- format(file,sizeof(file),"watches/%s.txt",PlayerName(playerid));
- new messaggio[256];
- format(messaggio,sizeof(messaggio),"%s\n%s\n%s\n%s\n%s",dini_Get(file,"watchname0"),dini_Get(file,"watchname1"),dini_Get(file,"watchname2"),dini_Get(file,"watchname3"),dini_Get(file,"watchname4"));
- ShowPlayerDialog(playerid,459,DIALOG_STYLE_LIST,"Select Slot",messaggio,"Wear","Unwear");
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 457)
- {
- if(response)
- {
- if(GetPlayerMoney(playerid)<20000) return SendClientMessage(playerid,0xFFFFFFFF,"You don't have enough money!");
- new file[56];
- format(file,sizeof(file),"watches/%s.txt",PlayerName(playerid));
- new messaggio[256];
- format(messaggio,sizeof(messaggio),"%s\n%s\n%s\n%s\n%s",dini_Get(file,"watchname0"),dini_Get(file,"watchname1"),dini_Get(file,"watchname2"),dini_Get(file,"watchname3"),dini_Get(file,"watchname4"));
- ShowPlayerDialog(playerid,458,DIALOG_STYLE_LIST,"Select Slot",messaggio,"Replace","Cancel");
- selectedwatchslot[playerid]=listitem;
- return 1;
- }
- }
- if(dialogid == 458)
- {
- if(response)
- {
- new file[56];
- format(file,sizeof(file),"watches/%s.txt",PlayerName(playerid));
- if(selectedwatchslot[playerid]==0)
- {
- new stringo[56];
- format(stringo,sizeof(stringo),"watchname%d",listitem);
- dini_Set(file,stringo,"Golden Watch");
- new stringo2[56];
- format(stringo2,sizeof(stringo2),"watch%d",listitem);
- dini_IntSet(file,stringo2,19039);
- SetPlayerAttachedObject(playerid, 9, 19039, 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
- EditAttachedObject(playerid, 9);
- GivePlayerMoney(playerid, -20000);
- }
- if(selectedwatchslot[playerid]==1)
- {
- new stringo[56];
- format(stringo,sizeof(stringo),"watchname%d",listitem);
- dini_Set(file,stringo,"Silver Watch");
- new stringo2[56];
- format(stringo2,sizeof(stringo2),"watch%d",listitem);
- dini_IntSet(file,stringo2,19040);
- SetPlayerAttachedObject(playerid, 9, 19040, 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
- EditAttachedObject(playerid, 9);
- GivePlayerMoney(playerid, -20000);
- }
- if(selectedwatchslot[playerid]==2)
- {
- new stringo[56];
- format(stringo,sizeof(stringo),"watchname%d",listitem);
- dini_Set(file,stringo,"Bronze Watch");
- new stringo2[56];
- format(stringo2,sizeof(stringo2),"watch%d",listitem);
- dini_IntSet(file,stringo2,19041);
- SetPlayerAttachedObject(playerid, 9, 19041, 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
- EditAttachedObject(playerid, 9);
- GivePlayerMoney(playerid, -20000);
- }
- if(selectedwatchslot[playerid]==3)
- {
- new stringo[56];
- format(stringo,sizeof(stringo),"watchname%d",listitem);
- dini_Set(file,stringo,"Red Watch");
- new stringo2[56];
- format(stringo2,sizeof(stringo2),"watch%d",listitem);
- dini_IntSet(file,stringo2,19045);
- SetPlayerAttachedObject(playerid, 9, 19045, 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
- EditAttachedObject(playerid, 9);
- GivePlayerMoney(playerid, -20000);
- }
- if(selectedwatchslot[playerid]==4)
- {
- new stringo[56];
- format(stringo,sizeof(stringo),"watchname%d",listitem);
- dini_Set(file,stringo,"Green Watch");
- new stringo2[56];
- format(stringo2,sizeof(stringo2),"watch%d",listitem);
- dini_IntSet(file,stringo2,19046);
- SetPlayerAttachedObject(playerid, 9, 19046, 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
- EditAttachedObject(playerid, 9);
- GivePlayerMoney(playerid, -20000);
- }
- if(selectedwatchslot[playerid]==5)
- {
- new stringo[56];
- format(stringo,sizeof(stringo),"watchname%d",listitem);
- dini_Set(file,stringo,"Blue Watch");
- new stringo2[56];
- format(stringo2,sizeof(stringo2),"watch%d",listitem);
- dini_IntSet(file,stringo2,19047);
- SetPlayerAttachedObject(playerid, 9, 19047, 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
- EditAttachedObject(playerid, 9);
- GivePlayerMoney(playerid, -20000);
- }
- if(selectedwatchslot[playerid]==6)
- {
- new stringo[56];
- format(stringo,sizeof(stringo),"watchname%d",listitem);
- dini_Set(file,stringo,"Funky Watch");
- new stringo2[56];
- format(stringo2,sizeof(stringo2),"watch%d",listitem);
- dini_IntSet(file,stringo2,19049);
- SetPlayerAttachedObject(playerid, 9, 19049, 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
- EditAttachedObject(playerid, 9);
- GivePlayerMoney(playerid, -20000);
- }
- }
- }
- if(dialogid == 459)
- {
- new file[56];
- format(file,sizeof(file),"watches/%s.txt",PlayerName(playerid));
- if(response)
- {
- if(IsPlayerAttachedObjectSlotUsed(playerid, 9))
- {
- SendClientMessage(playerid,0xFFFFFFFF,"You need to unwear the watch you are wearing to wear this one.");
- return 1;
- }
- new stringo[56];
- format(stringo,sizeof(stringo),"watch%d",listitem);
- if(dini_Int(file,stringo)==0) return SendClientMessage(playerid,0xFFFFFFFF,"There is no watch in this slot!");
- SetPlayerAttachedObject(playerid, 9, dini_Int(file,stringo), 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
- EditAttachedObject(playerid, 9);
- }
- else
- {
- if(IsPlayerAttachedObjectSlotUsed(playerid, 9)) RemovePlayerAttachedObject(playerid, 9);
- return 1;
- }
- }
- return 1;
- }
- stock PlayerName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, MAX_PLAYER_NAME);
- return name;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement