[SOLVED] -
Matej_ - 09.09.2010
I need help with this:
I made a timer so after 5 seconds bomb will explode,
I already made a command to plant a bomb I just need a help with this.
Here is a code:
pawn Код:
forward Bomb();
public Bomb()
{
new Float:X, Float:Y, Float:Z;
new playerid;
Timer1 = SetTimerEx("Bomb",5000,false,"d",playerid);
CreateExplosion(X, Y, Z, 2, 2);
KillTimer(Timer1);
}
And here is a command to plant a bomb:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
{
switch(dialogid)
{
case 1:
{
switch(listitem)
{
case 0:
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
CreateObject(1252, X, Y, Z, 0.0, 0.0, 96.0);
}
} }
}
}
Re: [Help]Timer -
LarzI - 09.09.2010
Cut out [pawn] Timer1 = SetTimerEx("Bomb",5000,false,"d",playerid);/pawn] and put it inside your command instead.
You also have to change
pawn Код:
forward Bomb();
public Bomb()
to
pawn Код:
forward Bomb(playerid);
public Bomb(playerid)
Re: [Help]Timer -
Matej_ - 09.09.2010
You also have to change
pawn Код:
forward Bomb();
public Bomb()
to
pawn Код:
forward Bomb(playerid);
public Bomb(playerid)
[/QUOTE]
I got 2 errors
C:\Users\..\...\samp03bsvr_R2_win32\filterscripts\ BombMenu.pwn(110) : warning 219: local variable "playerid" shadows a variable at a preceding level
C:\Users\..\....\samp03bsvr_R2_win32\filterscripts \BombMenu.pwn(110) : warning 203: symbol is never used: "playerid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Warnings.
Re: [Help]Timer -
Matej_ - 09.09.2010
nvm I fixed the problem.
Now I am going to test it,anyway thank you for the help !
Re: [Help]Timer -
LarzI - 09.09.2010
Remove "new playerid;"
This forum requires that you wait 120 seconds between posts. Please try again in 70 seconds. - go hang yourself
Ok, good job ^^
Re: [Help]Timer -
Matej_ - 09.09.2010
It still doesnt work, bomb doesnt explode after 5 seconds !
Re: [Help]Timer -
mrcoolballs - 09.09.2010
You have to GetPlayerPos(playerid,X,Y,Z); on the explosion otherwize it will create a explosion at the coordinates 0,0,0
Re: [Help]Timer -
Matej_ - 09.09.2010
thanks it works

but how can i create that it will explode at there where is the bomb planted ?
Re: [Help]Timer -
Matej_ - 09.09.2010
sorry for double post .. I fixed the problem, thanks guys !
Re: [Help]Timer -
Dudits - 09.09.2010
Add this to the top of your script.
pawn Код:
new Float:bombx, Float:bomby, Float:bombz;
On your command, change this.
pawn Код:
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
CreateObject(1252, X, Y, Z, 0.0, 0.0, 96.0);
To this.
pawn Код:
GetPlayerPos(playerid, bombx, bomby, bombz);
CreateObject(1252, bombx, bomby, bombz, 0.0, 0.0, 96.0);
Now on your public, change the CreateExplosion to this.
pawn Код:
CreateExplosion(bombx, bomby, bombz, 2, 2);