Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- main(){}
- #define DIALOG_RANGE_MAIN 100
- #define DIALOG_RANGE_SPEED 101
- #define DIALOG_RANGE_WEAPON 102
- #define SendFormatMessage(%0,%1,%2,%3) format(String, sizeof(String),%2,%3) \
- && SendClientMessage(%0, %1, String)
- #define SendFormatMessageToAll(%0,%1,%2) format(String, sizeof(String),%1,%2) \
- && SendClientMessageToAll(%0, String)
- new
- pSRObj[MAX_PLAYERS],
- pSRType[MAX_PLAYERS],
- Float:pSRSpeed[MAX_PLAYERS],
- pSRMoved[MAX_PLAYERS],
- pSRTimer[MAX_PLAYERS],
- pSRScore[MAX_PLAYERS],
- pName[MAX_PLAYER_NAME][MAX_PLAYERS],
- String[256],
- BestRangePointName[MAX_PLAYER_NAME], // משתנה נשמר לשם השחקן עם הכי הרבה נקודות
- BestRangePointScore // משתנה נשמר לכמות עם הכי הרבה נקודות
- ;
- enum ShootingRangeInfo
- {
- srHName[15],
- srObj,
- Float:srSpeed[3],
- Float:srPos1[3],
- Float:srPos2[3]
- };
- new srInfo[][ShootingRangeInfo] =
- {
- {"שמאל / ימין", 1584, {5.0, 12.0, 15.0}, {810.0, 1635.0, 4.0}, {791.0, 1635.0, 4.0}},
- {"למעלה / למטה", 1583, {10.0, 20.0, 24.0}, {801.0, 1638.0, 4.0}, {801.0, 1638.0, 12.0}},
- {"אלסון", 1584, {10.0, 18.0, 30.0}, {810.0, 1614.0, 4.0}, {797.0, 1649.0, 4.0}},
- {"התפוגגות", 1583, {13.0, 24.0, 32.0}, {801.0, 1624.0, 4.0}, {801.0, 1659.0, 7.0}},
- {"אחורה / קדימה", 1583, {7.0, 15.0, 30.0}, {801.0, 1638.0, 4.0}, {801.0, 1661.0, 4.0}}
- };
- CMD:range(playerid, params[])
- {
- for (new i; i < sizeof(srInfo); i++) format(String, sizeof(String), "%s%d\t%s\n", String, i, srInfo[i][srHName]);
- format(String, sizeof(String), "#\tסגנון\n%s", String);
- ShowPlayerDialog(playerid,DIALOG_RANGE_MAIN,DIALOG_STYLE_TABLIST_HEADERS,"מטווח",String,"אישור", "");
- return 1;
- }
- public OnPlayerConnect(playerid) return GetPlayerName(playerid, pName[playerid], MAX_PLAYER_NAME);
- 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 OnGameModeExit()
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case DIALOG_RANGE_MAIN:
- {
- if (!response) return 0;
- format(String, sizeof(String), "#\tמהירות\tסגנון\n01\t%f\tאיטי\n02\t%f\tמהיר\n03\t%f\tמהיר מאוד", srInfo[pSRType[playerid]][srSpeed][0], srInfo[pSRType[playerid]][srSpeed][1], srInfo[pSRType[playerid]][srSpeed][2]);
- ShowPlayerDialog(playerid,DIALOG_RANGE_SPEED,DIALOG_STYLE_TABLIST_HEADERS,"מטווח > מהירות",String,"אישור", "");
- pSRType[playerid] = listitem;
- }
- case DIALOG_RANGE_SPEED:
- {
- if (!response) return cmd_range(playerid, "");
- ShowPlayerDialog(playerid, DIALOG_RANGE_WEAPON, DIALOG_STYLE_TABLIST_HEADERS, "מטווח > מהירות > נשקים", "#\tנשק\n1\tSniper Rifle - צלף רייפל\n2\tCountry Rifle - קאנטרי רייפל\n3\tAK47 - קלשניקוב 47","אישור", "");
- pSRSpeed[playerid] = srInfo[pSRType[playerid]][srSpeed][listitem];
- MovePlayerObject(playerid, pSRObj[playerid], srInfo[pSRType[playerid]][srPos2][0], srInfo[pSRType[playerid]][srPos2][1], srInfo[pSRType[playerid]][srPos2][2], pSRSpeed[playerid], 0.0, 0.0, 0.0);
- pSRMoved[playerid] = 0;
- }
- case DIALOG_RANGE_WEAPON:
- {
- if (!response) return OnDialogResponse(playerid, DIALOG_RANGE_MAIN, 1, pSRType[playerid], "");
- switch(listitem)
- {
- case 0: GivePlayerWeapon(playerid, 34, 99999);
- case 1: GivePlayerWeapon(playerid, 33, 99999);
- case 2: GivePlayerWeapon(playerid, 30, 99999);
- }
- SetPlayerPos(playerid, 801.5965,1668.9072,5.2813);
- SetPlayerFacingAngle(playerid, 181.3183);
- PlayerRange(playerid, 60, 10);
- pSRObj[playerid] = CreatePlayerObject(playerid, srInfo[pSRType[playerid]][srObj], srInfo[pSRType[playerid]][srPos2][0], srInfo[pSRType[playerid]][srPos2][1], srInfo[pSRType[playerid]][srPos2][2], 0.0, 0.0, 0.0);
- SetPlayerVirtualWorld(playerid, playerid);
- }
- }
- return 1;
- }
- public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
- {
- if ((hittype == BULLET_HIT_TYPE_PLAYER_OBJECT) && (hitid == pSRObj[playerid]))
- {
- DestroyPlayerObject(playerid, pSRObj[playerid]);
- pSRObj[playerid] = CreatePlayerObject(playerid, srInfo[pSRType[playerid]][srObj], srInfo[pSRType[playerid]][srPos2][0], srInfo[pSRType[playerid]][srPos2][1], srInfo[pSRType[playerid]][srPos2][2], 0.0, 0.0, 0.0);
- if (pSRMoved[playerid]) MovePlayerObject(playerid, pSRObj[playerid], srInfo[pSRType[playerid]][srPos1][0], srInfo[pSRType[playerid]][srPos1][1], srInfo[pSRType[playerid]][srPos1][2], pSRSpeed[playerid], 0.0, 0.0, 0.0);
- else MovePlayerObject(playerid, pSRObj[playerid], srInfo[pSRType[playerid]][srPos2][0], srInfo[pSRType[playerid]][srPos2][1], srInfo[pSRType[playerid]][srPos2][2], pSRSpeed[playerid], 0.0, 0.0, 0.0);
- }
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- if (objectid == pSRObj[playerid])
- {
- pSRMoved[playerid] = pSRMoved[playerid]?(0):(1);
- if (pSRMoved[playerid]) MovePlayerObject(playerid, pSRObj[playerid], srInfo[pSRType[playerid]][srPos1][0], srInfo[pSRType[playerid]][srPos1][1], srInfo[pSRType[playerid]][srPos1][2], pSRSpeed[playerid], 0.0, 0.0, 0.0);
- else MovePlayerObject(playerid, pSRObj[playerid], srInfo[pSRType[playerid]][srPos2][0], srInfo[pSRType[playerid]][srPos2][1], srInfo[pSRType[playerid]][srPos2][2], pSRSpeed[playerid], 0.0, 0.0, 0.0);
- }
- return 1;
- }
- forward PlayerRange(playerid, time, attamp);
- public PlayerRange(playerid, time, attamp)
- {
- new str[128];
- if (!IsPlayerConnected(playerid))
- {
- // השחקן יצא מהשרת בלה בלה בצ'אט
- if (IsValidPlayerObject(playerid, pSRObj[playerid])) DestroyPlayerObject(playerid, pSRObj[playerid]);
- pSRType[playerid] = -1;
- pSRSpeed[playerid] = 0.0;
- pSRMoved[playerid] = -1;
- pSRScore[playerid] = 0;
- KillTimer(pSRTimer[playerid]);
- }
- if (!IsPlayerInRangeOfPoint(playerid, 5.0, 801.5965, 1668.9072, 5.2813))
- {
- attamp--;
- if (attamp > 0) SendFormatMessage(playerid, -1, "!חזור אל מתחם המטווח או שתפסל %d/10", attamp);
- else
- {
- SendFormatMessage(playerid, -1, ">> [Range]: .נפסלת בגלל שיצאת מהאזור, אך צברת %d נקודות", pSRScore[playerid]);
- // השחקן בלה בלה יצא מהמתחם תרשום בצ'אט
- if (IsValidPlayerObject(playerid, pSRObj[playerid])) DestroyPlayerObject(playerid, pSRObj[playerid]);
- pSRType[playerid] = -1;
- pSRSpeed[playerid] = 0.0;
- pSRMoved[playerid] = -1;
- pSRScore[playerid] = 0;
- KillTimer(pSRTimer[playerid]);
- ResetPlayerWeapons(playerid);
- SpawnPlayer(playerid);
- }
- }
- if (time > 0)
- {
- time--;
- if (time % 20 == 0) SendFormatMessage(playerid, -1, ">> [Range]: .נותרו %d שניות מתוך 60 שניות וצברת %d נקודות", time, pSRScore[playerid]);
- format(str, sizeof(str), "~n~~n~~n~~n~~n~~n~~n~~y~~h~ time left: ! ~n~~y~ %d/60", time);
- GameTextForPlayer(playerid, str, 5400, 3);
- return pSRTimer[playerid] = SetTimerEx("PlayerRange", 1000, false, "ddd", playerid, time, attamp);
- }
- else
- {
- SendFormatMessage(playerid, -1, ">> [Range]: .צברת שיא של %d נקודות, כל הכבוד", pSRScore[playerid]);
- if (pSRScore[playerid] > BestRangePointScore)
- {
- SendFormatMessageToAll(-1, ">> [Range]: .ולכן נקבע שיא של %d נקודות לעומת השיא הקודם של %d נקודות %s שבר את השיא של השחקן %s השחקן", pSRScore[playerid], BestRangePointScore, BestRangePointName, pName[playerid]);
- format(BestRangePointName, MAX_PLAYER_NAME, pName[playerid]);
- }
- if (IsValidPlayerObject(playerid, pSRObj[playerid])) DestroyPlayerObject(playerid, pSRObj[playerid]);
- pSRType[playerid] = -1;
- pSRSpeed[playerid] = 0.0;
- pSRMoved[playerid] = -1;
- pSRScore[playerid] = 0;
- KillTimer(pSRTimer[playerid]);
- ResetPlayerWeapons(playerid);
- SpawnPlayer(playerid);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement