Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #define TRAMP (14449)
- #define MAX_TRAMPS (100)
- #define BOUNCINESS (0.19)
- #include <a_samp>
- #include <zcmd>
- enum tramp{
- objectid,
- Float:x,
- Float:y,
- Float:z}
- new Tramp[MAX_TRAMPS][tramp];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Loading Trampoline FS ");
- print("--------------------------------------\n");
- for(new i=0;i<MAX_TRAMPS;i++)Tramp[i][objectid]=-1;
- print("--------------------------------------");
- print(" FS Loaded ");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new i=0;i<MAX_TRAMPS;i++)
- {
- DestroyObject(Tramp[i][objectid]);
- }
- return 1;
- }/*
- minx:-1.7666
- maxx:1.7008
- miny:2.1237
- maxy:-2.4764
- */
- CMD:trampoline(playerid,params[])
- {
- new Float:X,Float:Y,Float:Z;
- GetPlayerPos(playerid,X,Y,Z);
- if(CreateTrampoline(X,Y,Z)!=-1)SendClientMessage(playerid,0xffffffaa,"Trampoline created");
- else SendClientMessage(playerid,0xffffffaa,"No free trampoline slots.");
- return 1;
- }
- CMD:destroytrampoline(playerid,params[])
- {
- if(DestroyTrampoline(strval(params))==1)SendClientMessage(playerid,0xffffffaa,"Trampoline Removed");
- else SendClientMessage(playerid,0xffffffaa,"Trampoline couldn't be removed check for syntax and existance of trampoline");
- return 1;
- }
- stock CreateTrampoline(Float:X,Float:Y,Float:Z)
- {
- for(new i=0;i<MAX_TRAMPS;i++)
- {
- if(Tramp[i][objectid]==-1)
- {
- Tramp[i][objectid]=CreateObject(TRAMP,X,Y,Z,0,0,0);
- Tramp[i][x]=X,Tramp[i][y]=Y,Tramp[i][z]=Z;
- return i;
- }
- }
- return -1;
- }
- stock DestroyTrampoline(trampolineid)
- {
- if(Tramp[trampolineid][objectid]!=-1)
- {
- DestroyObject(Tramp[trampolineid][objectid]);
- Tramp[trampolineid][objectid]=-1;
- Tramp[trampolineid][x]=0,Tramp[trampolineid][y]=0,Tramp[trampolineid][z]=0;
- return 1;
- }
- return 0;
- }
- public OnPlayerUpdate(playerid)
- {
- new Float:px,Float:py,Float:pz;
- GetPlayerPos(playerid,px,py,pz);
- for(new i;i<MAX_TRAMPS;i++)
- {
- if(Tramp[i][objectid]!=-1)
- {
- if(IsPlayerInArea(playerid,Tramp[i][x]-1.7666,Tramp[i][x]+1.7008,Tramp[i][y]-2.1237,Tramp[i][y]+2.4764))
- {
- if(pz>Tramp[i][z]+2.00200&&pz<Tramp[i][z]+2.00300)
- {
- new keys,ud,lr;
- GetPlayerKeys(playerid,keys,ud,lr);
- new Float:vx,Float:vy,Float:vz,Float:a;
- GetPlayerVelocity(playerid,vx,vy,vz);
- GetPlayerFacingAngle(playerid,a);
- if(a>45&&a<135)SetPlayerFacingAngle(playerid,90);
- else if(a>135&&a<225)SetPlayerFacingAngle(playerid,180);
- else if(a>225&&a<315)SetPlayerFacingAngle(playerid,270);
- else if((a>315&&a<360)||(a>0&&a<45))SetPlayerFacingAngle(playerid,0);
- if(ud > 0)
- {
- if(a>45&&a<135)SetPlayerVelocity(playerid,0.02,0,BOUNCINESS);
- else if(a>135&&a<225)SetPlayerVelocity(playerid,0,0.02,BOUNCINESS);
- else if(a>225&&a<315)SetPlayerVelocity(playerid,-0.02,0,BOUNCINESS);
- else if((a>315&&a<360)||(a>0&&a<45))SetPlayerVelocity(playerid,0,-0.02,BOUNCINESS);//north
- }
- else if(ud < 0)
- {
- if(a>45&&a<135)SetPlayerVelocity(playerid,-0.02,0,BOUNCINESS);
- else if(a>135&&a<225)SetPlayerVelocity(playerid,0,-0.02,BOUNCINESS);
- else if(a>225&&a<315)SetPlayerVelocity(playerid,0.02,0,BOUNCINESS);
- else if((a>315&&a<360)||(a>0&&a<45))SetPlayerVelocity(playerid,0,0.02,BOUNCINESS);//north
- }
- else if(lr > 0)
- {
- if(a>45&&a<135)SetPlayerVelocity(playerid,0,0.02,BOUNCINESS);
- else if(a>135&&a<225)SetPlayerVelocity(playerid,-0.02,0,BOUNCINESS);
- else if(a>225&&a<315)SetPlayerVelocity(playerid,0,-0.02,BOUNCINESS);
- else if((a>315&&a<360)||(a>0&&a<45))SetPlayerVelocity(playerid,0.02,0,BOUNCINESS);//north
- }
- else if(lr < 0)
- {
- if(a>45&&a<135)SetPlayerVelocity(playerid,0,-0.02,BOUNCINESS);
- else if(a>135&&a<225)SetPlayerVelocity(playerid,0.02,0,BOUNCINESS);
- else if(a>225&&a<315)SetPlayerVelocity(playerid,0,0.02,BOUNCINESS);
- else if((a>315&&a<360)||(a>0&&a<45))SetPlayerVelocity(playerid,-0.02,0,BOUNCINESS);//north
- }
- else
- {
- SetPlayerVelocity(playerid,0,0,BOUNCINESS);
- }
- }
- }
- }
- }
- return 1;
- }
- stock IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
- {
- new Float:Px, Float:Py, Float:Pz;
- GetPlayerPos(playerid, Px, Py, Pz);
- if (Px > minx && Px < maxx && Py > miny && Py < maxy) return 1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement