SA-MP Forums Archive
[HELP] Booby trap QUICK 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Booby trap QUICK help !!! (/showthread.php?tid=143409)



[HELP] Booby trap QUICK help !!! - Rasmus19 - 22.04.2010

http://forum.sa-mp.com/index.php?topic=158241.0

Could someone help me to make that bomb only buyable to fraction 8? I don't know dcmd that well. That won't take so much time for you. Thank you!


Re: [HELP] Booby trap QUICK help !!! - Thrarod - 22.04.2010

Check player's team and if player is fac 8 then allow cmd


Re: [HELP] Booby trap QUICK help !!! - Rasmus19 - 22.04.2010

But it's built on dcmd ?!?! What is the command in dcmd ?


Re: [HELP] Booby trap QUICK help !!! - IamNotKoolllll - 22.04.2010

Quote:
Originally Posted by Rasmus19
But it's built on dcmd ?!?! What is the command in dcmd ?
show the code il modify it


Re: [HELP] Booby trap QUICK help !!! - Rasmus19 - 22.04.2010

Код:
/*
At line number 27 you will find #define BOMBPRICE with the number 300 as default. Change the number 300 to the ammount of cash you want the
Player to pay to place a booby trap in hes current vehicle. Changing the number to 0 will result in the bomb is free!
Note when changing the price you will need to compile every time!


Vehicle Booby Trap system made by Desert 2010. Contact me on www.forum.sa-mp.com with the username Desert.
Do not remove my credits or edit the text above

Regards and enjoy
Desert
*/



#include <a_samp>
#include <dutils>

#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 unused ret_memcpy
#pragma tabsize 4

#define COLOUR_RED       0xFF3333AA
#define COLOUR_YELLOW     0xFFFF00AA


#define BOMBPRICE 300


#define FILTERSCRIPT

new booby[MAX_VEHICLES];

public OnFilterScriptInit()
{
	print("\n------------------------------------------------------------");
	print("Vehicle Booby Trap Filterscript has been succesfully loaded!");
	print("------------------------------------------------------------\n");
	return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(boobytrap,9,cmdtext);
	return 0;
}

dcmd_boobytrap(playerid,params[])
{
	#pragma unused params
	new vehicle;
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOUR_RED,"You need to be in a vehicle to booby trap it!");
	else
	{
	  vehicle = GetPlayerVehicleID(playerid);
	  if(booby[vehicle] == 1) return SendClientMessage(playerid,COLOUR_RED,"This vehicle has already been booby trapped!");
	  {
	    new cash = BOMBPRICE;
	    if(cash > 0)
	    {
				if(GetPlayerMoney(playerid) < BOMBPRICE) return SendClientMessage(playerid,COLOUR_RED,"You do not have money enough for a booby trap!");
				else
				{
			  	SendClientMessage(playerid,COLOUR_YELLOW,"Planted booby trap inside the car!");
			  	PlayerPlaySound(playerid,1057,0,0,0);
			  	GivePlayerMoney(playerid,-BOMBPRICE);
			  	booby[vehicle] = 1;
			  	RemovePlayerFromVehicle(playerid);
			  	GameTextForPlayer(playerid,"~r~Booby trapped",10000,4);
			  	return 1;
			  	}
				}
			else
			{
			  SendClientMessage(playerid,COLOUR_YELLOW,"Planted booby trap inside the car!");
			  PlayerPlaySound(playerid,1057,0,0,0);
			  booby[vehicle] = 1;
			  RemovePlayerFromVehicle(playerid);
			  return 1;
			  }
			}
		}
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == PLAYER_STATE_DRIVER)
	{
		new vehicle = GetPlayerVehicleID(playerid);
		if(booby[vehicle] == 1)
		{
			new Float:X,Float:Y,Float:Z;
			GetVehiclePos(vehicle,X,Y,Z);
			CreateExplosion(X,Y,Z,7,10);
			PlayerPlaySound(playerid,1057,0,0,0);
			booby[vehicle] = 0;
			SendClientMessage(playerid,COLOUR_RED,"Vehicle has been booby trapped!");
			GameTextForPlayer(playerid,"~r~Booby trapped",10000,4);
			return 1;
			}
		}
	return 1;
}



Re: [HELP] Booby trap QUICK help !!! - Rasmus19 - 23.04.2010

IamNotKool? :P


Re: [HELP] Booby trap QUICK help !!! - Desert - 23.04.2010

You should have posted this in my release topic :P

But search (with ctrl+f) for this line dcmd_boobytrap

And add this under #pragma unused params

if(faction[playerid] != return 0;


Or if you use SetPlayerTeam

if(GetPlayerTeam(playerid) != return 0;


Re: [HELP] Booby trap QUICK help !!! - Rasmus19 - 23.04.2010

But we use this:

Код:
if (PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8) //Hitman
I tried your way but nothing happens

Oh and sorry for not posting into your thread :P I thought you wouldn't read it anyways


Re: [HELP] Booby trap QUICK help !!! - Desert - 23.04.2010

Should look something like this

if(PlayerInfo[playerid][pMember] != 8 && PlayerInfo[playerid] != 8 ) return 0;

Should work


E: Rofl pwning sunglass smiley


Re: [HELP] Booby trap QUICK help !!! - Rasmus19 - 23.04.2010

It didin't work, neither FS or adding to the script

What might be the problem?