All pastes #591756 Raw Edit

Untitled

public text v1 · immutable
#591756 ·published 2007-06-27 11:35 UTC
rendered paste body
#include <a_samp>

#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#pragma tabsize 0
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT
#define TEAM_FORELLI_COLOR 0x6600FFAA
forward Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance);

public OnFilterScriptInit()
{
	print("n--------------------------------------");
	print(" 	Gibbs's Kamehameha.");
	print("--------------------------------------n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(kamehameha, 10, cmdtext);
	return 0;
}

dcmd_kamehameha(playerid, text[])
{
    new amount[256], type[256], idx;
    amount = strtok(text, idx);
    type = strtok(text, idx);
	if(!strlen(amount) || !strlen(type))
	{
		SendClientMessage(playerid,0x6600FFAA,"Usage: /kamehameha [amount] [ex type]");
		return 1;
	}
	if(strval(type) >= 13)
	{
		SendClientMessage(playerid,0x6600FFAA,"invalid explosion type");
		return 1;
	}
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	new dist = strval(amount);
	//GetXYInFrontOfPlayer(playerid, x, y, dist);
	for(new i; i < dist; i++)
 	{
 		new dis = (20*i);
    	GetXYInFrontOfPlayer(playerid, x, y, dis);
		CreateExplosion(x,y, z, strval(type), 10.0);
	}
	return 1;
}


Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
	new Float:a;
	GetPlayerPos(playerid, x, y, a);
	if (IsPlayerInAnyVehicle(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
	else GetPlayerFacingAngle(playerid, a);
	x += (distance * floatsin(-a, degrees));
	y += (distance * floatcos(-a, degrees));
	return a;
}

strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}