SA-MP Forums Archive
Explotion help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Explotion help (/showthread.php?tid=452896)

Pages: 1 2


Explotion help - MichaelWharton101 - 23.07.2013

Okay, I have worked on this for 3 days straight and no luck yet. I am trying to make it so when I type /nukeman it makes it so it causes a explosion on the person that types it, now I want it to spam the explosion till I type /nukeman again. So it would make like lets say 500 explosions in 60sec (Just a example). How would I do this? I have worked so hard on this and am not even close! please help me!

BTW I am using ZCMD


AW: Explotion help - Forbidden - 23.07.2013

Easy:
Lets do the Command, you must only have this to "convert" to a command processor.
First, you have to find out, which Coordinats the player have:
Quote:

new Float: x,
Float: y,
Float: z,
;
GetPlayerPos(playerid, x, y, z);

Now we got the Position.
Lets create the Explosion, with the Position:
Quote:

CreateExplosion(x, y, z, 11, 25.0);

11 stands for the type
25.0stands for the radius

End: If you want to do more Explosion, you can do a Timer, with repeating function.
But, one or maybe two Explosion can kill one Player...


Re: AW: Explotion help - MichaelWharton101 - 23.07.2013

Quote:
Originally Posted by Forbidden
Посмотреть сообщение
Easy:
Lets do the Command, you must only have this to "convert" to a command processor.
First, you have to find out, which Coordinats the player have:

Now we got the Position.
Lets create the Explosion, with the Position:

11 stands for the type
25.0stands for the radius

End: If you want to do more Explosion, you can do a Timer, with repeating function.
But, one or maybe two Explosion can kill one Player...
This is not to kill other players, this is so players will not come near me, and if I have a explosion repeating over and over the player wont come near me.

EDIT: And I already got it so I get the players cords, I need help making the command it's self.


AW: Re: AW: Explotion help - Forbidden - 23.07.2013

Quote:
Originally Posted by MichaelWharton101
Посмотреть сообщение
This is not to kill other players, this is so players will not come near me, and if I have a explosion repeating over and over the player wont come near me.

EDIT: And I already got it so I get the players cords, I need help making the command it's self.
You could say it...
I do this like I think this is right..
Do a for loop, do a variable up to 500, if the variable ends by the 500th "Explosion", stop the loop.
If you want, that someone dont want to come so near to you, there are better methods.


Re: AW: Re: AW: Explotion help - MichaelWharton101 - 23.07.2013

Quote:
Originally Posted by Forbidden
Посмотреть сообщение
You could say it...
I do this like I think this is right..
Do a for loop, do a variable up to 500, if the variable ends by the 500th "Explosion", stop the loop.
If you want, that someone dont want to come so near to you, there are better methods.
See, this all confuses me so much, could you give me a example of a cmd for this? That would prob help a lot.

EDIT: Something like this?
Код:
CMD:explode(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    new Float:x, Float:y, Float:z;
    {
        CreateExplosion(x, y, z, 11, 25.0); 
        SetPlayerArmour(playerid, 1000000000.0);
        SetPlayerHealth(playerid, 1000000000.0);
        SetTimerEx("Explode", 500, 0, "d", playerid);
    }
    else
    {
        ClearAnimations(playerid);
        SetPlayerArmour(playerid, 100.0);
        SetPlayerHealth(playerid, 100.0);
        return 1;
    }
    return 1;
}



AW: Explotion help - Forbidden - 23.07.2013

Lets say you see someone.
And he is a little kid who wants to troll.
Doing a command shouldnґt be a problem...
SScanf also..
Quote:

CMD:drop(playerid, params[])
{
new pID;
if(sscanf(params, "u", pID))
{
new Float: x,
Float: y,
Float: z,
;
GetPlayerPos(u, x, y, z + 150);
}
}
A really basic Command!
The Target "jump" 150 M to the z Coordinate, so upward.


Re: AW: Explotion help - MichaelWharton101 - 23.07.2013

Quote:
Originally Posted by Forbidden
Посмотреть сообщение
Lets say you see someone.
And he is a little kid who wants to troll.
Doing a command shouldnґt be a problem...
SScanf also..

A really basic Command!
The Target "jump" 150 M to the z Coordinate, so upward.
Look at the code I posed, on the EDIT, can you help me get that working?


AW: Explotion help - Forbidden - 23.07.2013

Thanks for Ignore my post, anyway:
Quote:

CMD:explode(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
{
new Float, Float:y, Float:z;
GetPlayerPos( playerid, x, y, z );
CreateExplosion(x, y, z, 11, 25.0);
SetPlayerArmour(playerid, 1000000000.0);
SetPlayerHealth(playerid, 1000000000.0);
SetTimerEx("Explode", 500, 0, "d", playerid);
}
else
{
ClearAnimations(playerid);
SetPlayerArmour(playerid, 100.0);
SetPlayerHealth(playerid, 100.0);
return 1;
}
return 1;
}

But, your timer stops after 500ms...
Adjust it..


Re: Explotion help - MichaelWharton101 - 23.07.2013

what should I adjust it to?


AW: Explotion help - Forbidden - 23.07.2013

The timer, forget it...
Just do it like I posted it.


Re: AW: Explotion help - MichaelWharton101 - 23.07.2013

Quote:
Originally Posted by Forbidden
Посмотреть сообщение
The timer, forget it...
Just do it like I posted it.
I'll test it and let you know how it works.


AW: Explotion help - Forbidden - 23.07.2013

No, dont.
There are some mistakes...
Wait
//EDIT
Код:
CMD:explode(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
{
new Float, Float:y, Float:z;
GetPlayerPos( playerid, x, y, z );
CreateExplosion(x, y, z, 11, 25.0); 
SetPlayerArmour(playerid, 1000000000.0);
SetPlayerHealth(playerid, 1000000000.0);
SetTimerEx("Explode", 500, 0, "d", playerid);
}
return 1;
}

forward Explode (playerid);
public Explode (playerid
{
ClearAnimations(playerid);
SetPlayerArmour(playerid, 100.0);
SetPlayerHealth(playerid, 100.0);
return 1;
}



Re: AW: Explotion help - MichaelWharton101 - 23.07.2013

Quote:
Originally Posted by Forbidden
Посмотреть сообщение
No, dont.
There are some mistakes...
Wait
//EDIT
Код:
CMD:explode(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
{
new Float, Float:y, Float:z;
GetPlayerPos( playerid, x, y, z );
CreateExplosion(x, y, z, 11, 25.0); 
SetPlayerArmour(playerid, 1000000000.0);
SetPlayerHealth(playerid, 1000000000.0);
SetTimerEx("Explode", 500, 0, "d", playerid);
}
return 1;
}

forward Explode (playerid);
public Explode (playerid
{
ClearAnimations(playerid);
SetPlayerArmour(playerid, 100.0);
SetPlayerHealth(playerid, 100.0);
return 1;
}
Okay, I'll try this.

EDIT1: I just got it to compile with no errors, let me go test it IG now

EDIT2: It only creates one explosion then is done.


AW: Explotion help - Forbidden - 23.07.2013

Sure, I think this is the endpoint of it.
But you can simply do it with more Explosions:
Just create a for loop, for exampe for( new = i; i < 500; i++ )


Re: Explotion help - MichaelWharton101 - 23.07.2013

how would I add that into the script then?


AW: Explotion help - Forbidden - 23.07.2013

If you want to learn something, you could try it on your own...
Here is the code:

Quote:

CMD:explode(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
{
new Float, Float:y, Float:z;
GetPlayerPos( playerid, x, y, z );
SetPlayerArmour(playerid, 1000000000.0);
SetPlayerHealth(playerid, 1000000000.0);
SetTimerEx("Explode", 5000, 0, "d", playerid);
for( new = i; i < 500, i++ )
{
CreateExplosion(x, y, z, 11, 25.0);
}
return 1;
}
return 1;
}

forward Explode (playerid);
public Explode (playerid
{
ClearAnimations(playerid);
SetPlayerArmour(playerid, 100.0);
SetPlayerHealth(playerid, 100.0);
return 1;
}

Untested, seen that return 1; is there because of the loop, could do a break...
//edit forgot i++


Re: AW: Explotion help - MichaelWharton101 - 23.07.2013

Quote:
Originally Posted by Forbidden
Посмотреть сообщение
If you want to learn something, you could try it on your own...
Here is the code:


Untested, seen that return 1; is there because of the loop, could do a break...
//edit forgot i++
Thanks for all your help, I'll rep you.

EDIT: I got major errors with that.

EDIT1: Fixed


AW: Explotion help - Forbidden - 23.07.2013

Alright, your first step, done


Re: Explotion help - MichaelWharton101 - 23.07.2013

hmm, Okay It shows the explosion now but when i walk around the explosion wont follow me


AW: Explotion help - Forbidden - 23.07.2013

Follow...
This will make it a bit harder for you.

Do a timer, like in the Command, which repeats after a time, example: SetTimerEx("ExplodeRepeat", 1000, true, "i", playerid);
In this public, you create the Explosion with the defined Position...