Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if defined _mapmark_included
- #endinput
- #endif
- #define _mapmark_included
- #if defined MAPMARK_CHECK_SPEED
- #else
- #define MAPMARK_CHECK_SPEED (400)
- #endif
- new Float:mapLastX[MAX_PLAYERS];
- new Float:mapLastY[MAX_PLAYERS];
- new Float:mapLastZ[MAX_PLAYERS];
- new mapWaiting[MAX_PLAYERS];
- stock Float:GDBP(Float:X, Float:Y, Float:Z, Float:PointX, Float:PointY, Float:PointZ) return floatsqroot(floatadd(floatadd(floatpower(floatsub(X, PointX), 2.0), floatpower(floatsub(Y, PointY), 2.0)), floatpower(floatsub(Z, PointZ), 2.0)));
- forward WaitForPositionChange(playerid);
- public WaitForPositionChange(playerid)
- {
- if(mapWaiting[playerid] == -1) return 1;
- SetTimerEx("WaitForPositionChange",MAPMARK_CHECK_SPEED,0,"d",playerid);
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid,X,Y,Z);
- if(GDBP(mapLastX[playerid], mapLastY[playerid], mapLastZ[playerid],X,Y,Z) > 5)
- {
- OnPlayerMarkMap(playerid,mapWaiting[playerid],X,Y,Z);
- mapWaiting[playerid] = -1;
- TogglePlayerControllable(playerid,1);
- SetPlayerPos(playerid,mapLastX[playerid],mapLastY[playerid],mapLastZ[playerid]);
- AllowPlayerTeleport(playerid,0);
- #if defined MAPMARK_ADMINTELEPORT
- #else
- AllowAdminTeleport(0);
- #endif
- }
- return 1;
- }
- SetPlayerMarkingMap(playerid,MarkID)
- {
- AllowPlayerTeleport(playerid,1);
- #if defined MAPMARK_ADMINTELEPORT
- #else
- AllowAdminTeleport(1);
- #endif
- TogglePlayerControllable(playerid,0);
- SetTimerEx("WaitForPositionChange",MAPMARK_CHECK_SPEED,0,"d",playerid);
- mapWaiting[playerid]=MarkID;
- GetPlayerPos(playerid,mapLastX[playerid],mapLastY[playerid],mapLastZ[playerid]);
- }
- forward OnPlayerMarkMap(playerid, MarkID, Float:X, Float:Y, Float:Z);
- // --- Help'n'Credits:
- /*
- If you want to control AllowAdminTeleport() in your FS / GM by yourself, then put
- "#define MAPMARK_ADMINTELEPORT"
- ABOVE (!)
- "#include <mapmark>"
- AND put
- public OnPlayerMarkMap(playerid, MarkID, Float:X, Float:Y, Float:Z)
- {
- return 1;
- }
- into your GM/FS, otherwise it won't work.
- There's no way to control AllowPlayerTeleport if some players aren't allowed to teleport around everywhere and others are...
- I know, there are ways to improve this, but ... lazy. Do that by urself and release it, if you want to.
- Created by NaS, please do NOT claim this as your own. And please, USE IT! :)
- You can copy this into your GM/FS and release it, without asking me. But don't say "HAHAHA I CREATED THIS!" or something. Thanx.
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement