Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********************************************************** pGuitarHero v1.0 ***
- *
- * Scriptname:
- * -» pGuitarHero
- *
- * Author:
- * -» Pablo_Borsellino
- * Changelog:
- * • v1.0 (10.10.2011)
- * -» Initial Release
- *
- * Need to use:
- * -» Sa:Mp 0.3d RC4 or higher
- *
- * Language:
- * -» English
- *
- * Description:
- * -» This Filterscript let rotate the Los Santos Ferris Wheel. Search for:
- * -» "[[CHANGE THIS]]" via pressing STRG+F for own Settings etc.
- *
- * Functions:
- * -» pGUITAR_START(playerid);
- *
- * Public's:
- * -» n/a
- *
- * Credit's:
- * -» n/a
- * Copyright © 2011 by Pablo_Borsellino
- *******************************************************************************/
- //____________________________________________________________________Include___
- #include <a_samp>
- //__________________________________________________________Useful definition___
- #define forEx(%0,%1) for(new %1=0;%1<%0;%1++)
- //__________________________________________________________________Setting's___
- /***** Milliseconds to pause after pressing the right or the left button! *****/
- #define pGUITAR_ARROW_SLEEP_TIME 100
- /*********************** How far the guitar is streamed ***********************/
- #define pGUITAR_DRAW_DISTANCE 40
- /***************** Music in background, while playing Guitar! *****************/
- #define pGUITAR_AUDIO_URL "http://pabloborsellino.square7.ch/GRP-Freeroam/Audio/LoginMusik.mp3"
- /********************************* Note times **********************************
- Example: 10,20,25,30,40,46,55,70
- Created eight notes. While anyone play the guitar, they moving from top to
- bottom. The first one after 10*100 Ms = 1000 Ms = 1 Second. The nother ones:
- 20 * 100 Ms = 2 Seconds
- 25 * 100 Ms = 2,5 Seconds
- 30 * 100 Ms = 3 Seconds
- 40 * 100 Ms = 4 Seconds
- 46 * 100 Ms = 4,6 Seconds
- 55 * 100 Ms = 5,5 Seconds
- 70 * 100 Ms = 7 Seconds
- Here, the note is generated at random from note position 1 (leftmost), 2 (center
- left), 3(center right) and 4 (rightmost). Do not use time intervals of less than
- 5 Ms. In the notes to be created quickly, the player thus has little chance to
- get the notes. */
- #define pGUITAR_NOTE_TIMES 8,16,24,32,40,48,56,64,70,80,85,90,98,105,112,119,125,134,148,156,170,179,194,200,208,216,224,232,240,248,256,260,264,270,280,285,290,298,305,312,319,330,340,350,356,362,370,387,393,400
- /*************************** Maximal Count of notes ****************************
- Count your numbers in the #define pGUITAR_NOTE_TIMES and use this Number in this
- #define like: pGUITAR_NOTE_TIMES is: "8,16,24,32,40,48", so that are 6 Numbers..
- now you have to use in this define (pGUITAR_MAX_NOTES) the six or more than six */
- #define pGUITAR_MAX_NOTES 100
- /********************************* Information *********************************
- Search for "[[CHANGE THIS]]" (without the " ") via pressing STRG+F and change
- the code at this lines. There you can input as example the Winamount or Messages
- if a player plays guitar well or better... */
- //_____________________________________________________________Don't touch it___
- new pGUITAR_ARROW[MAX_PLAYERS],
- pGUITAR_OBJECT[MAX_PLAYERS],
- pGUITAR_PERFECT_HITS[MAX_PLAYERS],
- pGUITAR_ARROW_POS_ID[MAX_PLAYERS],
- pGUITAR_NOTE_COUNT[MAX_PLAYERS],
- pGUITAR_CURRENT_NOTE[MAX_PLAYERS],
- bool:pGUITAR_ARROW_MOVED[MAX_PLAYERS],
- bool:pGUITAR_PLAYER_PLAYS[MAX_PLAYERS],
- pGUITAR_TOTAL_NOTE_COUNT[MAX_PLAYERS],
- pGUITAR_PLAYER_NOTES_TIMER[MAX_PLAYERS],
- PlayerText3D:pGUITAR_FINISH_LINE[MAX_PLAYERS],
- pGUITAR_NOTES[MAX_PLAYERS][pGUITAR_MAX_NOTES+2],
- pGUITAR_NOTE_OBJECTS[MAX_PLAYERS][pGUITAR_MAX_NOTES+2],
- Float:pGUITAR_OLD_POS[MAX_PLAYERS][4];
- //___________________________________________________________________Public's___
- public OnFilterScriptInit()
- {
- forEx(MAX_PLAYERS,playerid)
- {
- pGUITAR_PLAYER_PLAYS[playerid]=false;
- //[[CHANGE THIS]]
- //If you dont change the this line, everyone plays Guitar on Filterscript
- //loading/starting. You need to create your own Command, dialog or any-
- //-thing where you can start the Guitar playing. Or input this all this
- //code into your Gamemode and start the Guitar playing with the Function
- //below. (pGUITAR_START(playerid);)
- pGUITAR_START(playerid);
- //[[CHANGE THIS]]
- }
- return true;
- }
- //______________________________________________________________________________
- public OnFilterScriptExit()
- {
- forEx(MAX_PLAYERS,playerid)
- pGUITAR_STOP(playerid);
- return true;
- }
- //______________________________________________________________________________
- public OnPlayerObjectMoved(playerid,objectid)
- {
- if(objectid==(pGUITAR_OBJECT[playerid]+1))return true;
- if(IsPlayerConnected(playerid)&&pGUITAR_PLAYER_PLAYS[playerid]==true)
- DestroyPlayerObject(playerid,objectid);
- return true;
- }
- //______________________________________________________________________________
- public OnPlayerUpdate(playerid)
- {
- if(pGUITAR_PLAYER_PLAYS[playerid]==true)
- {
- new Keys,X,Y;
- GetPlayerKeys(playerid,Keys,X,Y);
- if(Y<0)//Right Key
- {
- if(pGUITAR_ARROW_POS_ID[playerid]==2&&pGUITAR_ARROW_MOVED[playerid]==true)
- {
- MovePlayerObject(playerid,pGUITAR_ARROW[playerid],1185.826538,-1379.61,12.85,0.5);pGUITAR_ARROW_POS_ID[playerid]=1;
- SetTimerEx("pGUITAR_ALLOW_ARROW_MOVING",pGUITAR_ARROW_SLEEP_TIME,false,"d",playerid);
- pGUITAR_ARROW_MOVED[playerid]=false;
- return true;
- }
- else if(pGUITAR_ARROW_POS_ID[playerid]==3&&pGUITAR_ARROW_MOVED[playerid]==true)
- {
- MovePlayerObject(playerid,pGUITAR_ARROW[playerid],1185.826538,-1379.58,12.85,0.5);pGUITAR_ARROW_POS_ID[playerid]=2;
- SetTimerEx("pGUITAR_ALLOW_ARROW_MOVING",pGUITAR_ARROW_SLEEP_TIME,false,"d",playerid);
- pGUITAR_ARROW_MOVED[playerid]=false;
- return true;
- }
- else if(pGUITAR_ARROW_POS_ID[playerid]==4&&pGUITAR_ARROW_MOVED[playerid]==true)
- {
- MovePlayerObject(playerid,pGUITAR_ARROW[playerid],1185.826538,-1379.551,12.85,0.5);pGUITAR_ARROW_POS_ID[playerid]=3;
- SetTimerEx("pGUITAR_ALLOW_ARROW_MOVING",pGUITAR_ARROW_SLEEP_TIME,false,"d",playerid);
- pGUITAR_ARROW_MOVED[playerid]=false;
- return true;
- }
- }
- else if(Y>0)//Left Key
- {
- if(pGUITAR_ARROW_POS_ID[playerid]==3&&pGUITAR_ARROW_MOVED[playerid]==true)
- {
- MovePlayerObject(playerid,pGUITAR_ARROW[playerid],1185.826538 ,-1379.524,12.85,0.5);pGUITAR_ARROW_POS_ID[playerid]=4;
- SetTimerEx("pGUITAR_ALLOW_ARROW_MOVING",pGUITAR_ARROW_SLEEP_TIME,false,"d",playerid);
- pGUITAR_ARROW_MOVED[playerid]=false;
- return true;
- }
- else if(pGUITAR_ARROW_POS_ID[playerid]==2&&pGUITAR_ARROW_MOVED[playerid]==true)
- {
- MovePlayerObject(playerid,pGUITAR_ARROW[playerid],1185.826538,-1379.551,12.85,0.5);pGUITAR_ARROW_POS_ID[playerid]=3;
- SetTimerEx("pGUITAR_ALLOW_ARROW_MOVING",pGUITAR_ARROW_SLEEP_TIME,false,"d",playerid);
- pGUITAR_ARROW_MOVED[playerid]=false;
- return true;
- }
- else if(pGUITAR_ARROW_POS_ID[playerid]==1&&pGUITAR_ARROW_MOVED[playerid]==true)
- {
- MovePlayerObject(playerid,pGUITAR_ARROW[playerid],1185.826538,-1379.58,12.85,0.5);pGUITAR_ARROW_POS_ID[playerid]=2;
- SetTimerEx("pGUITAR_ALLOW_ARROW_MOVING",pGUITAR_ARROW_SLEEP_TIME,false,"d",playerid);
- pGUITAR_ARROW_MOVED[playerid]=false;
- return true;
- }
- }
- }
- return true;
- }
- //_______________________________________________________________Own Public's___
- forward pGUITAR_START(playerid);
- public pGUITAR_START(playerid)
- {
- new Float:pGUITAR_OLD_POS_EX[4];
- GetPlayerPos(playerid,pGUITAR_OLD_POS_EX[0],pGUITAR_OLD_POS_EX[1],pGUITAR_OLD_POS_EX[2]);
- GetPlayerFacingAngle(playerid,pGUITAR_OLD_POS_EX[3]);
- pGUITAR_OLD_POS[playerid][0]=pGUITAR_OLD_POS_EX[0];
- pGUITAR_OLD_POS[playerid][1]=pGUITAR_OLD_POS_EX[1];
- pGUITAR_OLD_POS[playerid][2]=pGUITAR_OLD_POS_EX[2];
- pGUITAR_OLD_POS[playerid][3]=pGUITAR_OLD_POS_EX[3];
- if(pGUITAR_PLAYER_PLAYS[playerid]==true)return true;
- RemovePlayerFromVehicle(playerid);
- pGUITAR_ARROW_MOVED[playerid]=true;
- pGUITAR_PLAYER_PLAYS[playerid]=true;
- pGUITAR_OBJECT[playerid]=CreatePlayerObject(playerid,19317,1185.843505,-1379.569091,13.932065,0,0,90,pGUITAR_DRAW_DISTANCE); //pGUITAR_OBJECT (Bass)
- pGUITAR_ARROW[playerid]=CreatePlayerObject(playerid,19130,1185.826538,-1379.61,12.85,0,180,0,pGUITAR_DRAW_DISTANCE);//pGUITAR_ARROW
- pGUITAR_FINISH_LINE[playerid]=CreatePlayer3DTextLabel(playerid,"___________________",0xF1FE01FF,1185.880004,-1379.559702,13.33,40.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0);
- pGUITAR_ARROW_POS_ID[playerid]=1;
- pGUITAR_PERFECT_HITS[playerid]=0;
- pGUITAR_NOTE_COUNT[playerid]=0;
- pGUITAR_CURRENT_NOTE[playerid]=0;
- pGUITAR_TOTAL_NOTE_COUNT[playerid]=0;
- pGUITAR_PLAYER_NOTES_TIMER[playerid]=SetTimerEx("pGUITAR_NOTES_TIMER",100,true,"d",playerid);
- pGUITAR_SET(playerid,pGUITAR_NOTE_TIMES);
- PlayAudioStreamForPlayer(playerid,pGUITAR_AUDIO_URL,0,0,0,50,0);
- TogglePlayerControllable(playerid,false);
- SetPlayerCameraPos(playerid, 1186.47, -1379.54, 13.09);
- SetPlayerCameraLookAt(playerid, 1182.79, -1379.53, 16.47);
- SetPlayerPos(playerid,1189.1370,-1378.8746,13.5296);
- return true;
- }
- forward pGUITAR_STOP(playerid);
- public pGUITAR_STOP(playerid)
- {
- if(pGUITAR_PLAYER_PLAYS[playerid]==false)return true;
- SetPlayerPos(playerid,pGUITAR_OLD_POS[playerid][0],pGUITAR_OLD_POS[playerid][1],pGUITAR_OLD_POS[playerid][2]);
- SetPlayerFacingAngle(playerid,pGUITAR_OLD_POS[playerid][3]);
- StopAudioStreamForPlayer(playerid);
- SetCameraBehindPlayer(playerid);
- TogglePlayerControllable(playerid,true);
- pGUITAR_ARROW_MOVED[playerid]=false;
- pGUITAR_PLAYER_PLAYS[playerid]=false;
- DestroyPlayerObject(playerid,pGUITAR_OBJECT[playerid]);
- DestroyPlayerObject(playerid,pGUITAR_ARROW[playerid]);
- DeletePlayer3DTextLabel(playerid,pGUITAR_FINISH_LINE[playerid]);
- KillTimer(pGUITAR_PLAYER_NOTES_TIMER[playerid]);
- forEx((pGUITAR_NOTE_COUNT[playerid]+1),NOTEs)if(IsValidPlayerObject(playerid,pGUITAR_NOTE_OBJECTS[playerid][NOTEs]))
- DestroyPlayerObject(playerid,pGUITAR_NOTE_OBJECTS[playerid][NOTEs]);
- return true;
- }
- forward MoveNote(playerid,NoteID);
- public MoveNote(playerid,NoteID)
- {
- if(pGUITAR_NOTE_COUNT[playerid]==0)
- {
- pGUITAR_NOTE_OBJECTS[playerid][pGUITAR_NOTE_COUNT[playerid]]=CreatePlayerObject(playerid,19260,1185.880004,-1379.608276,14.31,90,0,0,pGUITAR_DRAW_DISTANCE);
- MovePlayerObject(playerid,pGUITAR_NOTE_OBJECTS[playerid][pGUITAR_NOTE_COUNT[playerid]],1185.880004,-1379.608886,13.2,0.2);
- SetTimerEx("pGUITAR_MOVE_FINISHED",4150,false,"ddd",playerid,NoteID,pGUITAR_NOTE_OBJECTS[pGUITAR_NOTE_COUNT[playerid]]);
- pGUITAR_NOTE_COUNT[playerid]++;
- return true;
- }
- if(NoteID==0)
- {
- pGUITAR_NOTE_OBJECTS[playerid][pGUITAR_NOTE_COUNT[playerid]]=CreatePlayerObject(playerid,19260,1185.880004,-1379.608276,14.31,90,0,0,pGUITAR_DRAW_DISTANCE);
- MovePlayerObject(playerid,pGUITAR_NOTE_OBJECTS[playerid][pGUITAR_NOTE_COUNT[playerid]],1185.880004,-1379.608886,13.2,0.2);
- }
- else if(NoteID==1)
- {
- pGUITAR_NOTE_OBJECTS[playerid][pGUITAR_NOTE_COUNT[playerid]]=CreatePlayerObject(playerid,19260,1185.880004,-1379.593750,14.31,90,0,0,pGUITAR_DRAW_DISTANCE);
- MovePlayerObject(playerid,pGUITAR_NOTE_OBJECTS[playerid][pGUITAR_NOTE_COUNT[playerid]],1185.880004,-1379.577758,13.2,0.2);
- }
- else if(NoteID==2)
- {
- pGUITAR_NOTE_OBJECTS[playerid][pGUITAR_NOTE_COUNT[playerid]]=CreatePlayerObject(playerid,19260,1185.880004,-1379.581176,14.31,90,0,0,pGUITAR_DRAW_DISTANCE);
- MovePlayerObject(playerid,pGUITAR_NOTE_OBJECTS[playerid][pGUITAR_NOTE_COUNT[playerid]],1185.880004,-1379.547729,13.2,0.2);
- }
- else if(NoteID==3)
- {
- pGUITAR_NOTE_OBJECTS[playerid][pGUITAR_NOTE_COUNT[playerid]]=CreatePlayerObject(playerid,19260,1185.880004,-1379.569702,14.31,90,0,0,pGUITAR_DRAW_DISTANCE);
- MovePlayerObject(playerid,pGUITAR_NOTE_OBJECTS[playerid][pGUITAR_NOTE_COUNT[playerid]],1185.880004,-1379.517700,13.2,0.2);
- }
- SetTimerEx("pGUITAR_MOVE_FINISHED",4550,false,"ddd",playerid,NoteID,pGUITAR_NOTE_OBJECTS[playerid][pGUITAR_NOTE_COUNT[playerid]]);
- pGUITAR_NOTE_COUNT[playerid]++;
- if(pGUITAR_TOTAL_NOTE_COUNT[playerid]==pGUITAR_NOTE_COUNT[playerid])
- SetTimerEx("pGUITAR_FINISHED",6000,false,"d",playerid);
- return true;
- }
- //______________________________________________________________________________
- forward pGUITAR_FINISHED(playerid);
- public pGUITAR_FINISHED(playerid)
- {
- new Float:pGUITAR_HIT_RATIO = (pGUITAR_PERFECT_HITS[playerid]/pGUITAR_TOTAL_NOTE_COUNT[playerid]);
- if(pGUITAR_HIT_RATIO==1.0)//100% (Mega Perfect)
- {
- //[[CHANGE THIS]]
- //This function is called when the player finished all NOTEs (100% Hit)
- }
- if(pGUITAR_HIT_RATIO==0.9)//90% (Perfect)
- {
- //[[CHANGE THIS]]
- //This function is called when the player finished all NOTEs (90% Hit)
- }
- if(pGUITAR_HIT_RATIO==0.8)//80% (Really Good)
- {
- //[[CHANGE THIS]]
- //This function is called when the player finished all NOTEs (80% Hit)
- }
- if(pGUITAR_HIT_RATIO==0.7)//70% (Good)
- {
- //[[CHANGE THIS]]
- //This function is called when the player finished all NOTEs (70% Hit)
- }
- if(pGUITAR_HIT_RATIO==0.6)//60% (Okay+)
- {
- //[[CHANGE THIS]]
- //This function is called when the player finished all NOTEs (60% Hit)
- }
- if(pGUITAR_HIT_RATIO==0.5)//50% (Normal)
- {
- //[[CHANGE THIS]]
- //This function is called when the player finished all NOTEs (100% Hit)
- }
- if(pGUITAR_HIT_RATIO==0.4)//40% (Okay-)
- {
- //[[CHANGE THIS]]
- //This function is called when the player finished all NOTEs (100% Hit)
- }
- if(pGUITAR_HIT_RATIO==0.3)//30% (Well)
- {
- //[[CHANGE THIS]]
- //This function is called when the player finished all NOTEs (100% Hit)
- }
- if(pGUITAR_HIT_RATIO==0.2)//20% (Really Well)
- {
- //[[CHANGE THIS]]
- //This function is called when the player finished all NOTEs (100% Hit)
- }
- if(pGUITAR_HIT_RATIO==0.1)//10% (Bad)
- {
- //[[CHANGE THIS]]
- //This function is called when the player finished all NOTEs (100% Hit)
- }
- if(pGUITAR_HIT_RATIO==0.0)//0% (Mega Bad)
- {
- //[[CHANGE THIS]]
- //This function is called when the player finished all NOTEs (100% Hit)
- }
- pGUITAR_STOP(playerid);
- return true;
- }
- //______________________________________________________________________________
- forward pGUITAR_MOVE_FINISHED(playerid,NoteID,ObjectID);
- public pGUITAR_MOVE_FINISHED(playerid,NoteID,ObjectID)
- {
- UpdatePlayer3DTextLabelText(playerid,pGUITAR_FINISH_LINE[playerid],randomEx(0xBFC0C2FF,0x330000FF,0x000000FF,0x33AA33AA,0xFF6347AA,0x33CCFFAA,0x9ACD32AA,0xFFFF00AA,0xF5DEB3AA,0xFFFFFFAA,0xC2A2DAAA,0x2641FEAA,0xFF8282AA,0xFFA500AA,0xFF00FFFF,0xFF9933FF),"___________________");
- if((pGUITAR_ARROW_POS_ID[playerid]-1)==NoteID)
- {
- //[[CHANGE THIS]]
- //This function is called when the player hit the mark with the arrow.
- GameTextForPlayer(playerid,"~g~Perfect!",200,3);
- pGUITAR_PERFECT_HITS[playerid]++;
- }
- else
- {
- //[[CHANGE THIS]]
- //This function is called when the player does not hit the mark with the arrow.
- GameTextForPlayer(playerid,"~r~Fail!",200,3);
- }
- return true;
- }
- //______________________________________________________________________________
- forward pGUITAR_ALLOW_ARROW_MOVING(playerid);
- public pGUITAR_ALLOW_ARROW_MOVING(playerid)return pGUITAR_ARROW_MOVED[playerid]=true;
- //______________________________________________________________________________
- forward pGUITAR_NOTES_TIMER(playerid);
- public pGUITAR_NOTES_TIMER(playerid)
- {
- pGUITAR_CURRENT_NOTE[playerid]++;
- forEx(pGUITAR_MAX_NOTES+2,i)if(pGUITAR_NOTES[playerid][i]==pGUITAR_CURRENT_NOTE[playerid])
- MoveNote(playerid,random(3-0));
- return true;
- }
- //____________________________________________________________________Stock's___
- stock randomEx(...)return getarg(random(numargs()));
- stock pGUITAR_SET(playerid,...)
- {
- new FUNC_ArgCount=numargs();
- forEx(FUNC_ArgCount,i)
- {
- if(i==pGUITAR_MAX_NOTES+2)return true;
- new Arg=getarg(i);
- pGUITAR_NOTES[playerid][i]=Arg;
- pGUITAR_TOTAL_NOTE_COUNT[i]=FUNC_ArgCount;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement