Aim Training system. Need help rep +
#1

I need a system like this. Rep +1 i need help



Код:
AddPlayerClass(230,1433.5638,1328.6313,10.8203,0.8908,0,0,0,0,0,0); // trainingposspawn
AddPlayerClass(230,1433.4250,1345.5702,10.8130,0.3973,0,0,0,0,0,0); // trainingobject
AddPlayerClass(230,1441.1388,1348.8584,10.8130,291.8001,0,0,0,0,0,0); // trainingobjectmove1
AddPlayerClass(230,1438.1956,1359.2809,10.8203,25.5660,0,0,0,0,0,0); // trainingobjectmove2
AddPlayerClass(230,1427.1980,1356.3873,10.8203,104.8558,0,0,0,0,0,0); // trainingobjectmove3
AddPlayerClass(230,1423.0305,1348.7422,10.8203,140.2236,0,0,0,0,0,0); // trainingobjectmove4
AddPlayerClass(230,1434.4091,1345.0801,10.8130,237.7730,0,0,0,0,0,0); // trainingobjectmove5
AddPlayerClass(230,1433.3895,1361.8324,10.8203,39.6425,0,0,0,0,0,0); // trainingobjectmove6
AddPlayerClass(230,1437.0270,1371.0566,10.8203,336.6385,0,0,0,0,0,0); // trainingobjectmove7
These are the positions I want the objects to spawn and move to etc


Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>

#if defined FILTERSCRIPT
new InGame[MAX_PLAYERS];

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Beasthian'a Aim Training Filterscript");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

CMD:train(playerid, params[])
{
  SetPlayerVirtualWorld(playerid, 69);
  CreatePlayerObject(playerid,2056,-5.9348,1556.2980,12.75000, 0.00000, 0.00000, 90.00000);
  ShowPlayerDialog(playerid, 269, DIALOG_STYLE_LIST,"Select Weapon","Spas\nDegal\nM4","SELECT","");
  SetPlayerPos(playerid, 18.5876,1561.9489,12.7500);
  return 1;
  
}


CMD:leavetraining(playerid, params[])
{
    InGame[playerid] = 0;
    //We'll loop through every objects at first.
    for(new i; i< MAX_OBJECTS; i++) {
        //Then, we'll see if it's a player object or not.
        if(!IsValidPlayerObject(playerid, i)) continue; //If it's not a valid player object, it will skip that loop value.
        DestroyPlayerObject(playerid, i); //In case if there's any player objects, it will be destroying them.
    }
    SetPlayerHealth(playerid, 0);
    SendClientMessage(playerid, -1, "{FFD700} You have left the Weapon skills training zone.");
    return 1;


}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 269)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
				GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 999);
				SendClientMessage(playerid, 0xFFFFAA00,"Weapon Spas Selected - Game Started!");
				MovePlayerObject(playerid, 2062,10.1055,1549.0374,12.7500, 5000);
				MovePlayerObject(playerid, 2062, 10.1055,1549.0374,12.7500, 5000);
				MovePlayerObject(playerid, 2062, 10.1055,1549.0374,12.7500, 5000);
				InGame[playerid] = 1;
				}
                case 1:
				{
				SendClientMessage(playerid, 0xFFFFAA00,"Weapon Degal Selected - Game Started!");
				GivePlayerWeapon(playerid, WEAPON_DEAGLE, 999);
				MovePlayerObject(playerid, 2062,10.1055,1549.0374,12.7500, 5000);
				MovePlayerObject(playerid, 2062, 10.1055,1549.0374,12.7500, 5000);
				MovePlayerObject(playerid, 2062, 10.1055,1549.0374,12.7500, 5000);

				InGame[playerid] = 1;
				}
                case 2:
                {
                SendClientMessage(playerid, 0xFFFFAA00,"Weapon M4 Selected - Game Started!");
				GivePlayerWeapon(playerid, WEAPON_M4, 999);
				MovePlayerObject(playerid, 2062,10.1055,1549.0374,12.7500, 5000);
				MovePlayerObject(playerid, 2062, 10.1055,1549.0374,12.7500, 5000);
				MovePlayerObject(playerid, 2062, 10.1055,1549.0374,12.7500, 5000);

				InGame[playerid] = 1;
				}
            }
        }
        return 1;
    }
    return 0;
}


#endif


// object id will be 2062


public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(hittype == BULLET_HIT_TYPE_PLAYER_OBJECT)
        if(IsValidPlayerObject(playerid, hitid))
        PlayerPlaySound(playerid, 1132, 0, 0, 0);


    return 1;
}
I got this so far but I don't understand how its gona work. If anyone can make a full new system I would be greatful
Reply
#2

How would I do this... I create an array with all coordinates of points the object can go to.
Код:
new Float:TrainingObjectMoving[7][3] = {
{1441.1388,1348.8584,10.8130},
{1438.1956,1359.2809,10.8203},
...
{1437.0270,1371.0566,10.8203}
};
Also, when u create an object u should assing it's id to some sort of variable:
Код:
new TrainingObject[MAX_PLAYERS];//to ur global variables
And change
Код:
CreatePlayerObject(playerid,2056,-5.9348,1556.2980,12.75000, 0.00000, 0.00000, 90.00000);
Into
Код:
TrainingObject[playerid] =CreatePlayerObject(playerid,2056,-5.9348,1556.2980,12.75000, 0.00000, 0.00000, 90.00000);
Then, on player enter training area, rand a number to get the first coordinates to move to, course AFTER u create an object itself...
Код:
new rpos = rand(7);
MovePlayerObect(playerid,TrainingObject[playerid],TrainingObjectMoving[rpos][0],
TrainingObjectMoving[rpos][1],TrainingObjectMoving[rpos][2], 1.0/*this is the speed value, u might want to edit it!*/);
U copy and paste this one into OnPlayerWeaponShot and OnPlayerObjectMoved.
It is still a pretty rought idea of what u should do, but I should have left something for u to figure out urself, othervise u would just copy it, and didn't develop form it.
Good luck!
Reply
#3

The thing is im not that good with pawn..

Edit: I followed what you told me but i get this error

Код:
D:Desktop\Pawn Scripts\AimTraining.pwn(69) : error 017: undefined symbol "rand"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    new rpos = rand(7);
	MovePlayerObject(playerid,TrainingObject[playerid],TrainingObjectMoving[rpos][0],
	TrainingObjectMoving[rpos][1],TrainingObjectMoving[rpos][2], 1.0);
    if(hittype == BULLET_HIT_TYPE_PLAYER_OBJECT)
        if(IsValidPlayerObject(playerid, hitid))
        PlayerPlaySound(playerid, 1132, 0, 0, 0);
	return 1;
}
NVM I fixed it. you didn't need new rpos=..etc

just define needed to define "rand"

ill test it out ;p
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)