Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #define SUCCESS 0x1CD5E3AA
- #define FAILURE 0x2D49D2AA
- forward Tstart(playerid);
- forward TObjectC(playerid);
- //------------------------------------------------
- public OnFilterScriptInit()
- {
- print("\filterskripta ucitana- napravio Retardedwolf Preveo Smiljan\n");
- return 1;
- }
- new
- Ttimer;
- //------------------------------------------------
- COMMAND:trening(playerid, params[])
- {
- new
- Float:x,
- Float:y,
- Float:z;
- GetPlayerPos(playerid, x, y, z);
- if(IsPlayerInRangeOfPoint(playerid, 10, 801.61639404297, 1670.5484619141, 4.9562497138977))
- {
- if(GetPVarInt(playerid, "training") == 0)
- {
- SendClientMessage(playerid, SUCCESS, "Trening ce poceti za sekundu.");
- SendClientMessage(playerid, SUCCESS, "Ako zelis zavrsiti s treningom");
- SendClientMessage(playerid, SUCCESS, "pisi | /zaustavitrening |");
- PlayerPlaySound(playerid, 1052, x, y, z);
- SetTimerEx("Tstart", 100, false, "d" ,playerid);
- SetPVarInt(playerid, "training", 1);
- }
- else
- {
- SendClientMessage(playerid, FAILURE, "Ti si Vec na treningu.");
- PlayerPlaySound(playerid, 1053, x, y, z);
- }
- }
- else
- {
- SendClientMessage(playerid, FAILURE, "Nisi blizu Shooting Range");
- }
- return 1;
- }
- COMMAND:zaustavitrening (playerid, params[])
- {
- new
- Float:x,
- Float:y,
- Float:z;
- GetPlayerPos(playerid, x, y, z);
- if(GetPVarInt(playerid, "training") == 1)
- {
- SendClientMessage(playerid, SUCCESS, "Trening je Gotov.");
- SendClientMessage(playerid, SUCCESS, "Ako zelis poceti ponovo");
- SendClientMessage(playerid, SUCCESS, "Pisi | /trening |");
- KillTimer(Ttimer);
- SetPVarInt(playerid, "training", 0);
- PlayerPlaySound(playerid, 1053, x, y, z);
- for(new obj, o=MAX_OBJECTS;obj<o;obj++)
- {
- DestroyPlayerObject(playerid, obj);
- }
- }
- else
- {
- SendClientMessage(playerid, FAILURE, "Nisi na treningu.");
- PlayerPlaySound(playerid, 1052, x, y, z);
- }
- return 1;
- }
- forward ObjectToPoint(playerid, Float:radi, objectid, Float:x, Float:y, Float:z);
- stock ObjectToPoint(playerid, Float:radi, objectid, Float:x, Float:y, Float:z) //By misko28
- {
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerObjectPos(playerid, objectid, oldposx, oldposy, oldposz);
- tempposx = (oldposx -x);
- tempposy = (oldposy -y);
- tempposz = (oldposz -z);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- return 0;
- }
- stock GetPosFromView(playerid, Float:distance, &Float:x, &Float:y, &Float:z) //By Crack
- {
- new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float:fz;
- GetPlayerCameraPos(playerid, cx, cy, cz);
- GetPlayerCameraFrontVector(playerid, fx, fy, fz);
- x = fx * distance + cx;
- y = fy * distance + cy;
- z = fz * distance + cz;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(GetPVarInt(playerid, "training") == 1)
- {
- if(newkeys & KEY_FIRE && GetPlayerWeapon(playerid) != 0)
- {
- new Float:x,
- Float:y,
- Float:z;
- GetPosFromView(playerid, 80, x, y, z);
- for(new ob,l=MAX_OBJECTS;ob<l;ob++)
- {
- if(ObjectToPoint(playerid, 1,ob, x, y, z) != 0)
- {
- DestroyPlayerObject(playerid, ob);
- }
- }
- }
- return 1;
- }
- return 0;
- }
- public Tstart(playerid)
- {
- if(GetPVarInt(playerid, "training") == 1)
- {
- Ttimer = SetTimerEx("TObjectC", 1000, true, "d", playerid);
- }
- return 1;
- }
- public TObjectC(playerid)
- {
- if(GetPVarInt(playerid, "training") == 1)
- {
- if(IsPlayerInRangeOfPoint(playerid, 10, 801.61639404297, 1670.5484619141, 4.9562497138977))
- {
- new randPos = random(19);
- new randObj = random(2);
- CreatePlayerObject(playerid, 1583 + randObj, 790 + randPos, 1640.0859375, 5, 0, 0, 0, 100);
- }
- else
- {
- SetPVarInt(playerid, "training", 0);
- SendClientMessage(playerid, FAILURE, "Napustio si zonu i izbacen si iz iste.");
- for(new obj, o=MAX_OBJECTS;obj<o;obj++)
- {
- DestroyPlayerObject(playerid, obj);
- }
- }
- }
- return 1;
- }
- COMMAND:gotosr(playerid, params[])
- {
- SetPlayerPos(playerid, 801.61639404297, 1670.5484619141, 4.9562497138977);
- SendClientMessage(playerid, SUCCESS, "Teleportiran si, Uzivaj u Treningu");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement