Question about 'frisking' other players
#1

Hello, So I have this heroin script now finally working a bit.
Код:
#include <a_samp>
/* Scrtipt Created by BlackFoX - Drugs Deliver Job */
// DEFINES
new druggate1;
new druggate2;
forward PlayerToPoint (Float:radi, playerid, Float:x, Float:y, Float:z);
new mState1;
new mState2;
new drugsfill;
new truck1full;
new truck2full;
new truck3full;
new PickUpD;
new PlayerDrugs[MAX_PLAYERS];
#define FILTERSCRIPT

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	mState1 = 0;
	mState2 = 0;
	drugsfill = 0;
	truck1full = 0;
	truck2full = 0;
	truck3full = 0;
	print("\n--------------------------------------");
	print(" Heroin Trucker Job");
	print("--------------------------------------\n");
	// CreateObject(975,2720.160,-2495.633,14.160,0.0,0.0,90.000); // GATE 2 OPEN
	// CreateObject(975,2720.158,-2397.089,14.136,0.0,0.0,90.000); // GATE 1 OPEN
	CreateObject(1523,2747.836,-2452.013,12.702,0.0,0.0,0.0);
	CreateObject(1523,2792.877,-2395.778,12.620,0.0,0.0,0.0);
	PickUpD = AddStaticPickup(1239,2,2353.3625,-2001.0662,13.5380); // Deliver Point / Buy Point
	return 1;
}
// PLAYER TO POINT FUNCTION
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
	new Float:oldposx, Float:oldposy, Float:oldposz;
	new Float:tempposx, Float:tempposy, Float:tempposz;
	GetPlayerPos(playerid, oldposx, oldposy, oldposz);
	tempposx = (oldposx -x);
	tempposy = (oldposy -y);
	tempposz = (oldposz -z);
	if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
	{
		return 1;
	}
	return 0;
}
//
public OnFilterScriptExit()
{
	return 1;
}

#else

main()

#endif

public OnGameModeInit()
{
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
	PlayerDrugs[playerid] = 0;
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
   
}


public OnPlayerText(playerid, text[])
{

}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/deliverheroin", cmdtext, true, 10) == 0)
	{
	if(PlayerToPoint(8.0,playerid,2353.3625,-2001.0662,13.5380))
	{
	if(drugsfill >= 30)
	{
	GameTextForPlayer(playerid,"~r~Crack Hole is Full",2000,1);
	return 1;
	}
    if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 403)
	{
	if(truck1full == 1)
	{
	truck1full = 0;
	drugsfill +=3;
	GivePlayerMoney(playerid,5000);
	GameTextForPlayer(playerid,"~b~Drug ~g~Delivered",2000,1);
	}
	else
	{
	GameTextForPlayer(playerid,"~r~Empty Truck",2000,1);
	}
	}
    if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 514)
	{
	if(truck2full == 1)
	{
	if(drugsfill >= 30)
	{
	GameTextForPlayer(playerid,"~r~Crack Hole is Full",2000,1);
	return 1;
	}
	truck2full = 0;
	drugsfill +=3;
	GivePlayerMoney(playerid,5000);
	GameTextForPlayer(playerid,"~b~Drug ~g~Delivered",2000,1);
	}
	else
	{
	GameTextForPlayer(playerid,"~r~Empty Truck",2000,1);
	}
	}
    if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 515)
	{
	if(truck3full == 1)
	{
	if(drugsfill >= 30)
	{
	GameTextForPlayer(playerid,"~r~Crack Hole is Full",2000,1);
	return 1;
	}
	truck3full = 0;
	drugsfill +=3;
	GivePlayerMoney(playerid,5000);
	GameTextForPlayer(playerid,"~b~Drug ~g~Delivered",2000,1);
	}
	else
	{
	GameTextForPlayer(playerid,"~r~Empty Truck",2000,1);
	}
	}
	}
	else
	{
	ErrorMsg(playerid,"you not at Deliver Point!");
	}
	return 1;
	}
	if (strcmp("/loadheroin", cmdtext, true, 10) == 0)
	{
	if(PlayerToPoint(8.0,playerid,-2172.2520,-207.7911,35.3203) || PlayerToPoint(8.0,playerid,-2172.2520,-207.7911,35.3203) || PlayerToPoint(8.0,playerid,-2172.2520,-207.7911,35.3203))
	{
    if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 403)
	{
	if(truck1full == 0)
	{
	truck1full = 1;
    GivePlayerMoney(playerid, -2000);
	SendClientMessage(playerid,0x00DC00F6,"Drugs Loaded. 3/3 Slots Full");
	}
	else
	{
	SendClientMessage(playerid,0xB30000F6,"Truck allready Loaded!");
	}
	}
    if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 514)
	{
	if(truck2full == 0)
	{
	truck2full = 1;
    GivePlayerMoney(playerid, -2000);
	SendClientMessage(playerid,0x00DC00F6,"Drugs Loaded. 3/3 Slots Full");
	}
	else
	{
	SendClientMessage(playerid,0xB30000F6,"Truck allready Loaded!");
	}
	}
    if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 515)
	{
	if(truck3full == 0)
	{
	truck3full = 1;
    GivePlayerMoney(playerid, -2000);
	SendClientMessage(playerid,0x00DC00F6,"Drugs Loaded. 3/3 Slots Full");
	}
	else
	{
	SendClientMessage(playerid,0xB30000F6,"Truck allready Loaded!");
	}
	}
	}
	else
	{
	ErrorMsg(playerid,"you Cant Load Drugs at this Place!");
	}
	return 1;
	}
	if (strcmp("/heroin", cmdtext, true, 10) == 0)
	{
	new DFormat[256];
	SendClientMessage(playerid,0xE5F600F6,"-========DRUGS=======-");
	format(DFormat,sizeof(DFormat),"-= Drug Packs %d    =-", PlayerDrugs[playerid]);
	SendClientMessage(playerid,0xE56D00F6,DFormat);
	SendClientMessage(playerid,0xE5F600F6,"-====================-");
	return 1;
	}
	if (strcmp("/buyheroin", cmdtext, true, 10) == 0)
	{
	if(PlayerToPoint(8.0,playerid,2353.3625,-2001.0662,13.5380))
	{
	if(drugsfill <=2) { GameTextForPlayer(playerid,"~r~The Drugs Empty Please Deliver First!",2000,1); return 1; }
	if(PlayerDrugs[playerid] >=2)
	{
	ErrorMsg(playerid,"you can only buy 3 Packs!");
	return 1;
	}
	PlayerDrugs[playerid] +=3;
	GivePlayerMoney(playerid,-500);
	GameTextForPlayer(playerid,"~b~You buy 3 Drug Packs you can use /takeheroin",2000,1);
	}
	else
	{
	ErrorMsg(playerid,"you to Far away from Drugs Buy/deliver Place!");
	}
	return 1;
	}
	if (strcmp("/takeheroin", cmdtext, true, 10) == 0)
	{
	if(PlayerDrugs[playerid] == 0) { GameTextForPlayer(playerid,"~r~You dont have Drugs",2000,1); return 1; }
	new Float:px, Float:py, Float:pz;
	GetPlayerPos(playerid,px,py,pz);
	CreatePickup(1241,3,px,py,pz);
	GameTextForPlayer(playerid,"~r~You Take Drugs",2000,1);
	PlayerDrugs[playerid] -=1;
	return 1;
	}
	return 0;
}
stock ErrorMsg(playerid, const string[])
{
new gethisname[256];
GetPlayerName(playerid,gethisname,sizeof(gethisname));
new ErrorFormat[256];
format(ErrorFormat,sizeof(ErrorFormat),"ERROR: %s %s",gethisname,string);
SendClientMessage(playerid,0xF60000F6,ErrorFormat);
}
public OnPlayerInfoChange(playerid)
{
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 403 )
    {
        GameTextForPlayer(playerid,"~b~Use /loaddheroin in Truck Garage",2000,1);
    }

    if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 514 )
    {
        GameTextForPlayer(playerid,"~b~Use /loadheroin in Truck Garage",2000,1);
    }

    if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 515)
    {
        GameTextForPlayer(playerid,"~b~Use /loadheroin in Truck Garage",2000,1);
    }
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	if(pickupid == PickUpD)
	{
	GameTextForPlayer(playerid,"~b~Use /buyheroin or /deliverheroin",2000,1);
	}
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}
What code should I use so that otherpeople/cops can frisk players to see if they have heroin.. or that they can frisk the truck to see if it has heroin
Reply


Messages In This Thread
Question about 'frisking' other players - by milanosie - 05.01.2012, 13:33

Forum Jump:


Users browsing this thread: 1 Guest(s)