Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define RANGE 0.5 //The range in which players will be detected as "stuck"
- stock UnstickPlayer(playerid)
- {
- new Float:x, Float:y, Float:z;
- new Float:x2, Float:y2, Float:z2;
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && GetPVarInt(i, "pSpawned") == 1 && i != playerid)
- {
- GetPlayerPos(i, x, y, z);
- }
- if(IsPlayerInRangeOfPoint(playerid, RANGE, x, y, z))
- {
- GetPlayerPos(playerid, x2, y2, z2);
- SetPlayerPos(playerid, x2+2.0, y2+2.0, z2);
- }
- }
- return 1;
- }
- main()
- {
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- SetPVarInt(playerid, "pSpawned", 0);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- SetPVarInt(playerid, "pSpawned", 1);
- SetTimerEx("Unstick", 500, false, "i", playerid);
- return 1;
- }
- forward Unstick(playerid);
- public Unstick(playerid)
- {
- UnstickPlayer(playerid);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment