Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #define name "Glasses Shop"
- #define ver "v 2"
- #define by "by Sk47"
- #define PRESSED(%0) \
- ((newkeys & (%0)) == (%0))
- #define GLASSES_COST 100
- new Text:Textdraw0;
- new Glasses[MAX_PLAYERS];
- new Timer[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("------------------------------------------------");
- printf("%s %s %s ",name,ver,by);
- print("------------------------------------------------");
- Textdraw0 = TextDrawCreate(181.000000,364.000000,"~r~KEY RIGHT ~w~- Next Glasses~n~~r~KEY LEFT ~w~- Previos Glasses~n~~r~KEY SPRINT ~w~- Buy Glasses~n~~r~KEY ENTER ~w~- Exit");
- TextDrawUseBox(Textdraw0,1);
- TextDrawBoxColor(Textdraw0,0x000000cc);
- TextDrawTextSize(Textdraw0,428.000000,10.000000);
- TextDrawAlignment(Textdraw0,0);
- TextDrawBackgroundColor(Textdraw0,0x000000ff);
- TextDrawFont(Textdraw0,1);
- TextDrawLetterSize(Textdraw0,0.499999,1.200000);
- TextDrawColor(Textdraw0,0xffffffff);
- TextDrawSetOutline(Textdraw0,1);
- TextDrawSetProportional(Textdraw0,1);
- TextDrawSetShadow(Textdraw0,1);
- return 1;
- }
- COMMAND:glasses(playerid,params[])
- {
- new Float:p[3];
- GetPlayerPos(playerid,p[0],p[1],p[2]);
- SetPVarFloat(playerid,"PosX",p[0]);
- SetPVarFloat(playerid,"PosY",p[1]);
- SetPVarFloat(playerid,"PosZ",p[2]);
- SetPVarInt(playerid,"Inter",GetPlayerInterior(playerid));
- SetPVarInt(playerid,"Virtual",GetPlayerVirtualWorld(playerid));
- SetPVarInt(playerid,"BuyGlasses",1);
- Glasses[playerid] = 19006;
- SetPlayerInterior(playerid,15);
- SetPlayerPos(playerid,218.6603,-98.6067,1005.2578);
- SetPlayerFacingAngle(playerid,271.3023);
- SetPlayerCameraPos(playerid,217.6669,-97.8175,1005.8);
- SetPlayerCameraLookAt(playerid,218.6638,-98.2785,1005.8);
- TogglePlayerControllable(playerid,false);
- Timer[playerid] = SetTimerEx("LeftAndRight",100,1,"i",playerid);
- TextDrawShowForPlayer(playerid,Textdraw0);
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(PRESSED(KEY_SECONDARY_ATTACK) && GetPVarInt(playerid,"BuyGlasses") == 1)
- {
- Glasses[playerid] = 0;
- RemovePlayerAttachedObject(playerid, 2);
- SetPlayerAttachedObject(playerid,2,GetPVarInt(playerid,"BuysGlasses"), 2, 0.1, 0.03, 0.0, 0.0, 90.0, 90.0);
- TogglePlayerControllable(playerid,true);
- SetCameraBehindPlayer(playerid);
- KillTimer(Timer[playerid]);
- SetPVarInt(playerid,"BuyGlasses",0);
- SetPlayerPos(playerid,GetPVarFloat(playerid,"PosX"),
- GetPVarFloat(playerid,"PosY"),GetPVarFloat(playerid,"PosZ"));
- SetPlayerInterior(playerid,GetPVarInt(playerid,"Inter"));
- SetPlayerVirtualWorld(playerid,GetPVarInt(playerid,"Virtual"));
- TextDrawHideForPlayer(playerid,Textdraw0);
- }
- if(PRESSED(KEY_SPRINT) && GetPVarInt(playerid,"BuyGlasses") == 1)
- {
- if(GetPlayerMoney(playerid) < GLASSES_COST) return
- SendClientMessage(playerid,0xFFFFFFFF,"У вас не хватает денег");
- RemovePlayerAttachedObject(playerid, 2);
- SetPlayerAttachedObject(playerid,2,Glasses[playerid], 2, 0.1, 0.03, 0.0, 0.0, 90.0, 90.0);
- GivePlayerMoney(playerid, - GLASSES_COST);
- TogglePlayerControllable(playerid,true);
- SetCameraBehindPlayer(playerid);
- KillTimer(Timer[playerid]);
- SetPVarInt(playerid,"BuyGlasses",0);
- SetPlayerPos(playerid,GetPVarFloat(playerid,"PosX"),
- GetPVarFloat(playerid,"PosY"),GetPVarFloat(playerid,"PosZ"));
- SetPlayerInterior(playerid,GetPVarInt(playerid,"Inter"));
- SetPlayerVirtualWorld(playerid,GetPVarInt(playerid,"Virtual"));
- TextDrawHideForPlayer(playerid,Textdraw0);
- }
- return 1;
- }
- forward LeftAndRight(playerid);
- public LeftAndRight(playerid)
- {
- new key,ud,lr;
- GetPlayerKeys(playerid,key,ud,lr);
- if(lr > 0 && GetPVarInt(playerid,"BuyGlasses") == 1)
- {
- if(Glasses[playerid] == 19035)
- {
- Glasses[playerid] = 19006;
- }
- else
- {
- Glasses[playerid] ++;
- }
- RemovePlayerAttachedObject(playerid, 2);
- SetPlayerAttachedObject(playerid,2,Glasses[playerid], 2, 0.1, 0.03, 0.0, 0.0, 90.0, 90.0);
- }
- if(lr < 0 && GetPVarInt(playerid,"BuyGlasses") == 1)
- {
- if(Glasses[playerid] == 19006)
- {
- Glasses[playerid] = 19035;
- }
- else
- {
- Glasses[playerid] --;
- }
- RemovePlayerAttachedObject(playerid, 2);
- SetPlayerAttachedObject(playerid,2,Glasses[playerid], 2, 0.1, 0.03, 0.0, 0.0, 90.0, 90.0);
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- KillTimer(Timer[playerid]);
- RemovePlayerAttachedObject(playerid, 2);
- TextDrawHideForPlayer(playerid,Textdraw0);
- return 1;
- }
- public OnFilterScriptExit()
- {
- TextDrawDestroy(Textdraw0);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement