SA-MP Forums Archive
Explosion 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: Explosion Help (/showthread.php?tid=294951)



Explosion Help - jiwan - 04.11.2011

hi Guys

i want to make a explosion on the point i was standing(in-game) with a timer of 5 seconds and it shows player "area is going to explode"

please help me with some examples !!


Re: Explosion Help - [GOD]Dragonster82 - 04.11.2011

Wrong section.

Request the fuction at:
https://sampforum.blast.hk/showthread.php?tid=187229


Re: Explosion Help - [MG]Dimi - 04.11.2011

WHen we are already here
PHP код:
forward CreatePlayerExplosion(playerid);
public 
CreatePlayerExplosion(playerid)
{
    new 
Float:Pos[3];
    
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
    
CreateExplosion(Pos[0],Pos[1],Pos[2],6,15.0);
    return 
1;
}

public 
OnPlayerCommandText(playerid,cmdtext[])
{
    if(!
strcmp(cmdtext,"/bomb",true))//replace it with your Command
    
{
        
SetTimerEx("CreatePlayerExplosion",1000*5,false,"d",playerid);
        
SendClientMessage(playerid,0xFF0000FF,"AREA IS GOING TO BLOW IN 5 SECONDS!!!");
        return 
1;
    }
    return 
0;




Re: Explosion Help - jiwan - 04.11.2011

The Explosion Becomes On the Point Where player is after 5 seconds ?
help me to make it on the point where it was Before 5 Seconds !!!!!!


Re: Explosion Help - SmiT - 04.11.2011

pawn Код:
forward CreatePlayerExplosion( playerid, &Float:x, &Float:y, &Float:z );
public CreatePlayerExplosion( playerid, &Float:x, &Float:y, &Float:z )
{
    CreateExplosion( Float:x, Float:y, Float:z, 6, 15.0 );
    return true;
}

public OnPlayerCommandText( playerid,cmdtext[] )
{
    if ( !strcmp ( cmdtext, "/bomb", true ) )
    {
        new
            Float: P[ 3 ];
        GetPlayerPos( playerid, P[ 0 ], P[ 1 ], P[ 2 ] );
        SetTimerEx( "CreatePlayerExplosion", 5000, false, "dfff", playerid, P[ 0 ], P[ 1 ], P[ 2 ] );
        SendClientMessage( playerid, -1,"Area is going to blow in 5 seconds" );
        return true;
    }
    return false;
}



Re: Explosion Help - jiwan - 04.11.2011

Quote:
Originally Posted by SmiT
Посмотреть сообщение
pawn Код:
forward CreatePlayerExplosion( playerid, &Float:x, &Float:y, &Float:z );
public CreatePlayerExplosion( playerid, &Float:x, &Float:y, &Float:z )
{
    CreateExplosion( Float:x, Float:y, Float:z, 6, 15.0 );
    return true;
}

public OnPlayerCommandText( playerid,cmdtext[] )
{
    if ( !strcmp ( cmdtext, "/bomb", true ) )
    {
        new
            Float: P[ 3 ];
        GetPlayerPos( playerid, P[ 0 ], P[ 1 ], P[ 2 ] );
        SetTimerEx( "CreatePlayerExplosion", 5000, false, "dfff", playerid, P[ 0 ], P[ 1 ], P[ 2 ] );
        SendClientMessage( playerid, -1,"Area is going to blow in 5 seconds" );
        return true;
    }
    return false;
}
why return false; ?? and "dfff"


Re: Explosion Help - SmiT - 04.11.2011

Well, that's just an example. Return false at the end of "OnPlayerCommandText" means whenever you type a wrong command, it will return "SERVER: UNKOWN COMMAND". For "dfff", d stands for integer wich we used it for the playerid, and f stands for float so we enlist 3 "f" in wich we will store the player position when he types the command - see SetTimerEx


Re: Explosion Help - jiwan - 05.11.2011

it is Crashing my server


Re: Explosion Help - jiwan - 05.11.2011

anyone ??


Re: Explosion Help - grand.Theft.Otto - 06.11.2011

Try this:

pawn Код:
// top of script

new Float: BombX;
new Float: BombY;
new Float: BombZ;

// onplayercommandtext

if(!strcmp (cmdtext, "/bomb", true, 5))
{
    GetPlayerPos(playerid,BombX,BombY,BombZ);
   
    SetTimerEx("CreatePlayerExplosion",5000,false,"dfff",playerid,BombX,BombY,BombZ);
   
    SendClientMessage(playerid, -1,"Bomb Planted ... The Area Will Explode In 5 Seconds!");
   
    return 1;
}

// bottom of script

forward CreatePlayerExplosion(playerid, &Float:x, &Float:y, &Float:z);
public CreatePlayerExplosion(playerid, &Float:x, &Float:y, &Float:z)
{
    CreateExplosion(Float:x, Float:y, Float:z, 6, 15.0);
    return 1;
}
If that fails to work, try this:

pawn Код:
// top of script

new Float: BombX;
new Float: BombY;
new Float: BombZ;

// onplayercommandtext

if(!strcmp (cmdtext, "/bomb", true, 5))
{
    GetPlayerPos(playerid,BombX,BombY,BombZ);

    SetTimerEx("CreatePlayerExplosion",5000,false,"dfff",playerid,BombX,BombY,BombZ);

    SendClientMessage(playerid, -1,"Bomb Planted ... The Area Will Explode In 5 Seconds!");

    return 1;
}

// bottom of script

forward CreatePlayerExplosion(playerid);
public CreatePlayerExplosion(playerid)
{
    CreateExplosion(BombX,BombY,BombZ,6,15);
    return 1;
}