All pastes #992958 Raw Edit

expfs

public text v1 · immutable
#992958 ·published 2008-04-22 07:12 UTC
rendered paste body
// made by weedarr [2007]
//thanks to dragsta for supplying explosion types, thanks to [fackin]luke for the explosion command
//for sa-mp 0.2.0 (will not work with 0.1, so dont try)
//do NOT change or modify any of this script and dont try to take credit for something that isnt yours

#include <a_samp>

strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' ') && (string[index] > '\r'))
{
index++;
}
new offset = index;
new result[30];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)) && (string[index] > '\r'))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}

new Float:boomX[MAX_PLAYERS];
new Float:boomY[MAX_PLAYERS];
new Float:boomZ[MAX_PLAYERS];

#define FILTERSCRIPT

#define COLOR_YELLOW 0xFFFF00AA

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
        print("\n--------------------------------------");
        print(" Pyrotechnics filterscript loaded");
        print("--------------------------------------\n");
        return 1;
}

public OnFilterScriptExit()
{
        return 1;
}

#else

main()
{
        print("\n----------------------------------");
        print(" Blank Gamemode by your name here");
        print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
        // Don't use these lines if it's a filterscript
        SetGameModeText("Blank Script");
        AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
        return 1;
}

public OnGameModeExit()
{
        return 1;
}



public OnPlayerSpawn(playerid)
{
    	SendClientMessage(playerid, 0xFF9900AA,"This script is running WeeDarrs pyrotechnics FS");
        SendClientMessage(playerid, 0xFF9900AA,"To see pyro commands type /pyrocmds");
        return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    	new cmd[256],idx;
    	cmd = strtok(cmdtext,idx);

        if (strcmp("/pyrocmds", cmdtext, true, 10) == 0)
        {
        SendClientMessage(playerid, 0x0000BBAA,"To save an explosion position type /saveexplosion");
        SendClientMessage(playerid, 0x0000BBAA,"Then move away and type /explosion [type] [radius]");
        SendClientMessage(playerid, 0x0000BBAA,"To see all explosion types type /types (lol)");
        SendClientMessage(playerid, 0xFFFF00AA,"Thanks to dragsta for supplying explosion types, thanks to [fackin]luke for the xplosion command");
        SendClientMessage(playerid, 0xFFFF00AA,"Made by WeeDarr [2007]");
        return 1;
        }

        if (strcmp("/types", cmdtext, true, 10) == 0)
        {
        SendClientMessage(playerid, 0x33AA33AA,"1.tank gun 2.quiet explosion 3.tank gun 4.similar to tank gun 5.flare thing");
        SendClientMessage(playerid, 0x33AA33AA,"6.flare2 7.big bang 8.bigger bang 9.no fire just noise 10.no fire just noise2");
        SendClientMessage(playerid, 0x33AA33AA,"11.big not much impact 12.quite small 13.tiny (from rc tank)");
        return 1;
        }

        if (strcmp("/saveexplosion", cmdtext, true, 10) == 0)
        {
        GetPlayerPos(playerid,Float:boomX[playerid],Float:boomY[playerid],Float:boomZ[playerid]);
        SendClientMessage(playerid, 0xFFFF00AA,"Position saved");
        return 1;
        }


        if (strcmp(cmd, "/explosion", true)==0)
{
    new tmp[256],str[256],type,Float:radius;
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid,COLOR_YELLOW,"USAGE: /explosion [type] [radius]");
        return 1;
    }
    type = strval(tmp);

    if(type < 0 || type > 13)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"Invalid Type. Valid Types are: 0-13");
        return 1;
    }

    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid,COLOR_YELLOW,"USAGE: /explosion [type] [radius]");
        return 1;
    }
    radius = strval(tmp);

    if(radius < 0 || radius > 100)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"Invalid radius size. Valid radius sizes are: 0-50");
        return 1;
    }
    else
    {

	format(str,sizeof(str),"You created an explosion with type: %d and radius: %f",type,radius);
	SendClientMessage(playerid,COLOR_YELLOW,str);
	CreateExplosion(Float:boomX[playerid],Float:boomY[playerid],Float:boomZ[playerid],type,radius);
    }
    return 1;
}

        return 0;
}