I have no idea how to script...
#9

It's actually pretty simple to make

https://sampwiki.blast.hk/wiki/PAWN_tutorial

for the teams...


A couple methods for force punch that might work...
pawn Код:
new bool:isJedi[MAX_PLAYERS] = false; //Creates a boolean so we can know if they're jedi - can replace with GetPlayerTeam or w/e you want
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        if(team[issuerid] != team[playerid]) //Making sure they aren't on the same team --replace with your team variable
        {
            if(isJedi[issuerid] == true) //Checks if they're a jedi with the boolean we created
            {
                if(GetPlayerWeapon(issuerid) == 0)
                {
                    new Float:X,
                        Float:Y,
                        Float:Z, //Creates X,Y,Z variables so we can store the co-ordinates in them
                        string[128]; //Create our string so we can format it
                    SetPlayerHealth(playerid, Health(playerid)-30); //Set their health -30
                    GetPlayerPos(playerid, X,Y,Z); //Get their X,Y,Z position then we store them in our variables
                    SetPlayerPos(playerid, X-3,Y-3,Z); //Set their X and Y position -3 hopefully setting them back --Untested
                   
                    format(string,sizeof(string), "%s force punched you!", Name(issuerid)); //Formats our string with the name of the one who hit the person
                    SendClientMessage(playerid, 0xCC0000AA, string); //Send it to the player who was hit
                }
            }
        }
    }
}
You'll need these for this to work
pawn Код:
stock Name(playerid)
{
    new nname[MAX_PLAYER_NAME]; //Create our name variable that's the size of 24 (MAX_PLAYER_NAME)
    GetPlayerName(playerid, nname, sizeof(nname)); //Store the name in our nname variable
    return nname; //return that name when we call our stock
}
stock Health(playerid)
{
    new Float:HP; //Creates our float so we can store HP in it
    GetPlayerHealth(playerid, HP); //Stores HP in it
    return floatround(HP); //returns the rounded health variable
}
That's method one, here's method two...

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(isJedi[playerid] == true) //Checks if they're a jedi
    {
        if(GetPlayerWeapon(playerid) == 0 && newkeys == KEY_FIRE) //Checks if they are using fists and attacked
        {
            new Float:x,Float:y,Float:z; //Creates new variables to store stuff
            GetPlayerPos(playerid, x,y,z); //Stores the players X,Y,Z position into the variables we created
            new str[50]; //Creates our string so we can format it
            for(new i; i<=MAX_PLAYERS; i++) //Creates a loop
            {
                if(IsPlayerConnected(i)) //Loops through the MAX_PLAYERS number and checks if players are connected
                {
                    if(IsPlayerInRangeOfPoint(i, 5, x,y,z) && isJedi[i] == false) //Checks if those players are in range of the player who punched and makes sure they aren't on the same team
                    {
                        GetPlayerPos(i, x,y,z); //Gets the pos of the ones in range
                        SetPlayerPos(i, x-3,y-3,z); //Sets their X and Y pos -3 (hopefully setting them backwards...might not work - probably not lol)
                        SetPlayerHealth(i, Health(i)-30); //Gets the health of the ones in range and sets it -30 their current HP
                        format(str,sizeof(str), "%s has force punched you!", Name(playerid)); //formats our string so we can send it to the ones hit
                        SendClientMessage(i, 0xCC0000AA, str);  //sends it to the players hit by the force punch
                    }
                }
            }
        }
    }
    return 1;
}
This one uses the same stocks as before & the same bool...
This one is also untested same as the first one...so I'm not sure how it would work or if it would work at all
Reply


Messages In This Thread
I have no idea how to script... - by ZetaReticuli - 28.12.2011, 06:41
Re: I have no idea how to script... - by Aira - 28.12.2011, 06:50
Re: I have no idea how to script... - by ZetaReticuli - 28.12.2011, 18:54
Re: I have no idea how to script... - by SnG.Scot_MisCuDI - 28.12.2011, 18:58
Re: I have no idea how to script... - by MatthewD - 28.12.2011, 19:01
Re: I have no idea how to script... - by -CaRRoT - 28.12.2011, 19:19
Re: I have no idea how to script... - by Mosslah - 28.12.2011, 22:03
Re: I have no idea how to script... - by Sting. - 28.12.2011, 22:35
Re: I have no idea how to script... - by [ABK]Antonio - 28.12.2011, 22:51
Re: I have no idea how to script... - by Guest9328472398472 - 30.12.2011, 18:40

Forum Jump:


Users browsing this thread: 4 Guest(s)