Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a comment
- // uncomment the line below if you want to write a filterscript
- //#define FILTERSCRIPT
- #include <a_samp>
- //UPDATE_TIME is the time interval to check if player is paused or not.
- #define UPDATE_TIME 2000
- //PauseTimerr is timer for each player.
- new PauseTimer[MAX_PLAYERS];
- //To check if player was paused earlier .
- new bool:Paused[MAX_PLAYERS];
- //This is your 3D Text Label
- new Text3D:PauseText[MAX_PLAYERS];
- main()
- {
- return 1;
- }
- public OnGameModeInit()
- {
- // Don't use these lines if it's a filterscript
- SetGameModeText("Blank Script");
- AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- KillTimer(PauseTimer[playerid]);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- PauseTimer[playerid] = SetTimerEx("Pause_Check",UPDATE_TIME,true,"i",playerid);
- //When a player spawn we start a timer which repeats itself after UPDATE_TIME (2000 ms)
- return 1;
- }
- forward Pause_Check(playerid);
- public Pause_Check(playerid)
- {
- new Float:x,Float:y,Float:z,Float:a;//Get Player Location and facing Angle.
- GetPlayerPos(playerid,x,y,z);
- GetPlayerFacingAngle(playerid,a);
- //If player's location is same as it was before UPDATE_TIME (2000 ms)
- if(x == GetPVarFloat(playerid,"x") && y == GetPVarFloat(playerid,"y") && z == GetPVarFloat(playerid,"z") && a == GetPVarFloat(playerid,"a"))
- {
- if (Paused[playerid] == false)//If he was not paused before 2 sec
- {
- //Create a 3D Text label .
- PauseText[playerid] = Create3DTextLabel("Paused", -1, x, y,z+1.5,100, GetPlayerVirtualWorld(playerid), 0);
- }
- //We now know he have paused.
- //This will take sure that we do not create multiple 3D text labels.
- Paused[playerid] = true;
- }
- //If he have moved/updated
- else
- {
- if (Paused[playerid] == true)//If he was paused before 2 sec.
- {
- Delete3DTextLabel(PauseText[playerid]);//We will delete the Label we created when he paused.
- }
- //And make him un pause.
- Paused[playerid] = false;
- }
- //Setting Player varibles.
- SetPVarFloat(playerid,"x",x);
- SetPVarFloat(playerid,"y",y);
- SetPVarFloat(playerid,"z",z);
- SetPVarFloat(playerid,"a",a);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement