Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- /*
- If Player is holding gun && pressing fire button && some time since the last report passed
- {
- GunReport(playerid);
- }
- */
- return 1;
- }
- new AREA_ARRAY [23][5] = //[Nr of Areas][X1, Y1, X2, Y2, AreaLevel]
- {
- { 114, 1400, 206, 1527, 4 },
- { 152, 1400, 333, 1117, 4 },
- { 206, 1117, 508, 1064, 4 },
- { 332, 1247, 488, 1117, 4 },
- { 508, 1117, 736, 984, 4 },
- { 736, 1018, 762, 984, 4 },
- { 627, 984, 762, 895, 4 },
- { 762, 936, 896, 724, 4 },
- { 724, 724, 896, 601, 4 },
- { 896, 895, 1037, 601, 4 },
- { 1037, 882, 1152, 601, 4 },
- { 1152, 960, 1355, 725, 4 },
- { 1272, 725, 1590, 545, 4 },
- { 1450, 895, 1590, 725, 4 },
- { 1395, 945, 1450, 852, 4 },
- { 1450, 945, 1537, 895, 4 },
- { 1537, 922, 1565, 895, 4 },
- { 1036, 1582, 1214, 1401, 4 },
- { 1068, 1401, 1292, 1286, 4 },
- { 562, 1327, 644, 1225, 4 },
- { 1392, 1843, 1590, 1738, 4 },
- { 1427, 1738, 1590, 1591, 4 },
- { 1550, 2401, 1848, 2180, 4 }
- };
- public GunReport(playerid)
- {
- new arealevel = GetPVarInt(playerid, "Area_Level");
- new randomNr = random(100);
- if ( arealevel == 4 )
- {
- if ( (randomNr+90) >= 100)
- {
- //Send Report
- }
- }
- if ( arealevel == 3 )
- {
- if ( (randomNr+50) >= 100)
- {
- //Send Report
- }
- }
- if ( arealevel == 2 )
- {
- if ( (randomNr+20) >= 100)
- {
- //Send Report
- }
- }
- if ( arealevel == 1 )
- {
- if ( (randomNr+5) >= 100)
- {
- //Send Report
- }
- }
- }
- public AreaCheck(playerid)
- {
- new Float:PX, Float:PY, Float:PZ;
- for(new i=0; i < MAX_PLAYERS; i++)
- {
- new highestlevel=0;
- GetPlayerPos(i, PX, PY, PZ);
- for ( new index = 0; index < sizeof AREA_ARRAY; index++ )
- {
- new Float:x1=AREA_ARRAY [index][0],
- Float:y1=AREA_ARRAY [index][1],
- Float:x2=AREA_ARRAY [index][2],
- Float:y2=AREA_ARRAY [index][3];
- new arealevel = AREA_ARRAY [index][4];
- if (x1 < x2)
- {
- if (y1 < y2)
- {
- if( (PX > x1) && (PX < x2) && (PY > y1) && (PY < y2) )
- {
- if (highestlevel < arealevel)
- {
- highestlevel = arealevel;
- }
- }
- }
- if (y2 < y1)
- {
- if( (PX > x1) && (PX < x2) && (PY < y1) && (PY > y2) )
- {
- if (highestlevel < arealevel)
- {
- highestlevel = arealevel;
- }
- }
- }
- }
- if (x2 < x1)
- {
- if (y1 < y2)
- {
- if( (PX < x1) && (PX > x2) && (PY > y1) && (PY > y2) )
- {
- if (highestlevel < arealevel)
- {
- highestlevel = arealevel;
- }
- }
- }
- if (y2 < y1)
- {
- if( (PX < x1) && (PX > x2) && (PY < y1) && (PY < y2) )
- {
- if (highestlevel < arealevel)
- {
- highestlevel = arealevel;
- }
- }
- }
- }
- }
- SetAreaLevel(playerid, highestlevel);
- }
- }
- public SetAreaLevel(playerid, alvl)
- {
- new currentlevel = GetPVarInt(playerid, "Area_Level");
- if ( currentlevel < alvl )
- {
- SetPVarInt(playerid, "Area_Level", alvl);
- }
- if ( currentlevel > alvl )
- {
- SetPVarInt(playerid, "Area_Level", alvl);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement