Distance from that player -
Lajko1 - 12.09.2013
I have problem with command, it works great but I want to add if that player I want to arrest to far from me it will return him message "Player is not near you" I think here I should use IsPlayerInRangeOfPoint but I don't know how to do rest at that code :/ may you help me out please ? And thanks in advance
Re: Distance from that player -
Lajko1 - 12.09.2013
Anyone please ? :/
Re: Distance from that player -
PrivatioBoni - 12.09.2013
Please can we see your code?
Re: Distance from that player -
DanishHaq - 12.09.2013
Use something like this:
pawn Код:
new giveplayerid; // this would be your other player's ID variable, but change it to your own...
new Float:x, Float:y, Float:z; // float positions
GetPlayerPos(playerid, Float:x, Float:y, Float:z); // Get the officer's position
if(IsPlayerInRangeOfPoint(giveplayerid, 5.0, x, y, z); // If the giveplayerid is in the range of the radius 5 from the playerid
{
// Your code for the arrest command
return 1;
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "You are not near that player.");
return 1;
}
Re: Distance from that player -
Lajko1 - 12.09.2013
This is what I wanted, but what about this?
if(!IsPlayerInRangeOfPoint(giveplayerid, 5.0, x, y, z);
Instead of this:
if(IsPlayerInRangeOfPoint(giveplayerid, 5.0, x, y, z);
Is same thing or.. ?
Re: Distance from that player -
DanishHaq - 12.09.2013
Adding the ! means that it's not. So adding the ! to the start of IsPlayerInRangeOfPoint is literally if the player ISN'T in range of the point.
So by adding that to your code (the !), it will mean that if the player is not in the range of 5.0 it will do something under that line. And under the else means that it will do it if the player is in range of that point.
AW: Distance from that player -
Skimmer - 12.09.2013
By the way you've a little error in your code DanishHaq. It should be
pawn Код:
if(IsPlayerInRangeOfPoint(giveplayerid, 5.0, x, y, z))
Re: Distance from that player -
Lajko1 - 12.09.2013
Well thank you guys but I was going on with scripting what does that mean ?
pawn Код:
(539) : error 048: array dimensions do not match
And here is error line:
pawn Код:
GetWeaponName(Weapon,WN, sizeof(WN));
and here are my "new"
pawn Код:
new
id,
Slot,
Weapon,
Ammo,
CNT,
X,
Str[128],
Float:x,
Float:y,
Float:z,
Name[MAX_PLAYER_NAME];
And weapon names.
pawn Код:
new WN[][32] =
{
{"Unarmed"}, {"Brass Knuckles"}, {"Golf Club"}, {"Night Stick"}, {"Knife"}, {"Baseball Bat"}, {"Shovel"}, {"Pool Cue"}, {"Katana"}, {"Chainsaw"},
{"Purple Dildo"}, {"Big White Vibrator"}, {"Medium White Vibrator"}, {"Small White Vibrator"}, {"Flowers"}, {"Cane"}, {"Grenade"}, {"Teargas"}, {"Molotov"},
{" "}, {" "}, {" "}, {"Colt 45"}, {"Colt 45 (Silenced)"}, {"Desert Eagle"}, {"Normal Shotgun"}, {"Sawnoff Shotgun"}, {"Combat Shotgun"}, {"Micro Uzi (Mac 10)"},
{"MP5"}, {"AK47"}, {"M4"}, {"Tec9"}, {"Country Rifle"}, {"Sniper Rifle"}, {"Rocket Launcher"}, {"Heat-Seeking Rocket Launcher"}, {"Flamethrower"}, {"Minigun"},
{"Satchel Charge"}, {"Detonator"}, {"Spray Can"}, {"Fire Extinguisher"}, {"Camera"}, {"Night Vision Goggles"}, {"Infrared Vision Goggles"}, {"Parachute"}, {"Fake Pistol"}
};
What should cause this error ? :/
Re: Distance from that player -
Lajko1 - 12.09.2013
Bump
Re: Distance from that player -
Konstantinos - 12.09.2013
Just use it as
WN[GetPlayerWeapon(playerid)]
pawn Код:
// Example:
new
test_msg[ 32 ]
;
format( test_msg, sizeof( test_msg ), "The weapon's name is \"%s\"", WN[ GetPlayerWeapon( playerid ) ] );