Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <W_Points>//http://pastebin.com/kxdzWUQ9
- new PlayerOnPoint[MAX_PLAYERS];
- new PointsTimer;
- public OnFilterScriptInit()
- {
- CreateColoredCheckpoint(0.0,0.0,4.0,0x99FFFF00);
- PointsTimer=SetTimer("PointsUpdate",200,1);//запуск псевдочекпойнтов.
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new j=1;j<MAX_POINTS;j++)
- if(PointInfo[j][Created])
- if(PointInfo[j][Type1]==1)
- {
- DestroyObject(PointInfo[j][Type2]);
- DestroyPoint(j);
- }
- KillTimer(PointsTimer);
- return 1;
- }
- //==============================================================================
- //==============================================================================
- forward PointsUpdate();
- public PointsUpdate()
- {
- for(new playerid;playerid<MAX_PLAYERS;++playerid)
- {
- if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
- {
- new newppoint = GetPlayerPoint(playerid);
- if(PlayerOnPoint[playerid]!=newppoint)
- {
- if(PlayerOnPoint[playerid]!=0)
- OnPlayerLeaveColoredCheckpoint(playerid,PlayerOnPoint[playerid]);
- if(newppoint!=0)
- OnPlayerEnterColoredCheckpoint(playerid,newppoint);
- PlayerOnPoint[playerid]= newppoint;
- }
- }
- }
- return 1;
- }
- stock OnPlayerEnterColoredCheckpoint(playerid,pointid)
- {
- new str[64];
- format(str,64,"ты вошёл в точку %d",pointid);
- SendClientMessage(playerid,0xFFFFFFFF,str);
- return 1;
- }
- stock OnPlayerLeaveColoredCheckpoint(playerid,pointid)
- {
- new str[64];
- format(str,64,"ты вышел из точки %d",pointid);
- SendClientMessage(playerid,0xFFFFFFFF,str);
- return 1;
- }
- stock CreateColoredCheckpoint(Float: x, Float: y, Float: z, color)
- {
- new pointid=CreatePoint(x,y,z,1.0,-1,1);
- if(pointid)
- {
- PointInfo[pointid][Type2]=CreateObject(1317, x, y, z, 0.0, 0.0, 0.0);
- SetObjectMaterial(PointInfo[pointid][Type2], 0, 18646, "none", "none", color);
- }
- return pointid;
- }
- stock DestroyColoredCheckpoint(pointid)
- {
- if(!IsValidPoint(pointid))return 0;
- DestroyObject(PointInfo[pointid][Type2]);
- return DestroyPoint(pointid);
- }
- //==============================================================================
- //==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement