SA-MP Forums Archive
Virtual World Shooting - 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: Virtual World Shooting (/showthread.php?tid=167809)



Virtual World Shooting - Rolyy - 13.08.2010

I'm looking for a start/beginning of a script that if you shoot you in 1 virtual world you get a new pos and other virt world

Example:
Shooting 3 times in ammunation and you'll get jailed for doing it.

I really don't know how to start scripting this..
If anyone could explain me how to add a If(playerid,Shootsinammunation) = SetPlayerPos & SendClientMessage etc.
I would appreciate this.


Re: Virtual World Shooting - akis_tze - 13.08.2010

maybe this will help you

Код:
Float:DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ,  Float:ObjX, Float:ObjY, Float:ObjZ,  Float:FrX, Float:FrY, Float:FrZ)
{

	new Float:TGTDistance;

	// get distance from camera to target
	TGTDistance = floatsqroot((CamX - ObjX) * (CamX - ObjX) + (CamY - ObjY) * (CamY - ObjY) + (CamZ - ObjZ) * (CamZ - ObjZ));

	new Float:tmpX, Float:tmpY, Float:tmpZ;

	tmpX = FrX * TGTDistance + CamX;
	tmpY = FrY * TGTDistance + CamY;
	tmpZ = FrZ * TGTDistance + CamZ;

	return floatsqroot((tmpX - ObjX) * (tmpX - ObjX) + (tmpY - ObjY) * (tmpY - ObjY) + (tmpZ - ObjZ) * (tmpZ - ObjZ));
}
stock IsPlayerAimingAt(playerid, Float:x, Float:y, Float:z, Float:radius)
{
    new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float:fz;
    GetPlayerCameraPos(playerid, cx, cy, cz);
    GetPlayerCameraFrontVector(playerid, fx, fy, fz);
    return (radius >= DistanceCameraTargetToLocation(cx, cy, cz, x, y, z, fx, fy, fz));
}



Re: Virtual World Shooting - Cameltoe - 13.08.2010

You can disable weapons in interiors


Re: Virtual World Shooting - Rolyy - 14.08.2010

Quote:
Originally Posted by akis_tze
Посмотреть сообщение
maybe this will help you
Not sure what to do with codes.. and what its for :S


Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
You can disable weapons in interiors
I don't want to disable weapons, Theres a weapon menu in it anyways.


Re: Virtual World Shooting - Claude - 14.08.2010

pawn Код:
if(IsPlayerInArea(playerid, ammu_x, ammu_y, ammu_z);
{
    if(newkeys == KEY_FIRE)
    {
        SetPVarInt(playerid, "ShootingAmmu", GetPVarInt(playerid, "ShootingAmmu")+1);
    }
    if(GetPVarInt(playerid, "ShootingAmmu") == 3)
    {
        // jail command
        SetPVarInt(playerid, "ShootingAmmu", 0); // 0 resets the pvar
    }
}
Add that at OnPlayerKeyStateChange


Re: Virtual World Shooting - Rolyy - 14.08.2010

For what distance is that

Код:
if(IsPlayerInArea(playerid, ammu_x, ammu_y, ammu_z);



Re: Virtual World Shooting - playbox12 - 14.08.2010

if(IsPlayerInArea(playerid, ammu_x, ammu_y, ammu_z);

You need to put the ammunation coords, go ingame and enter the ammunation do /save then goto C:\Program Files\Rockstar Games\GTA San Andreas\savedpositions.txt

Then get the last one, it would look something like this AddPlayerClass(0,0000,00000,0000,0000,0000,0000);

Which means AddPlayerClass(Skin,PosX,PosY,PosZ (thats all you need to know)

Copy the PosX PosY and PosZ into

ammu_x, ammu_y, ammu_z);

Hope it helps you.


Re: Virtual World Shooting - Rolyy - 14.08.2010

Quote:
Originally Posted by playbox12
Посмотреть сообщение
if(IsPlayerInArea(playerid, ammu_x, ammu_y, ammu_z);

You need to put the ammunation coords, go ingame and enter the ammunation do /save then goto C:\Program Files\Rockstar Games\GTA San Andreas\savedpositions.txt

Then get the last one, it would look something like this AddPlayerClass(0,0000,00000,0000,0000,0000,0000);

Which means AddPlayerClass(Skin,PosX,PosY,PosZ (thats all you need to know)

Copy the PosX PosY and PosZ into

ammu_x, ammu_y, ammu_z);

Hope it helps you.
That wasn't my question, I asked for what distance it was.
Not how it works.. :S


Re: Virtual World Shooting - Vince - 14.08.2010

It's to check if the player is in the ammu-nation.

But a more simpeler way is getting the interior from the player (or virtualworld for that matter) and see if it's the same as the ammu-nation interior.
Then run a check (IsPlayerInRangeOfPoint) to see if the player is actually in the ammu-nation and not some interior in the same interiorid.


Re: Virtual World Shooting - playbox12 - 14.08.2010

Oh k, I didn't really understood your question. So I just ergg guessed