What am i doing wrong!!!
#1

Hey im working on this command that you can only call when on a certain point but I keep being able to call it anywhere i am, help?

pawn Код:
COMMAND:repairvehicle(playerid, params[]) // repair vehicle for $175 at mechanic
{{
  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You are not in a vehicle! ))");
  if(GetPlayerMoney(playerid) < 175) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You don't have the money to perform this action! ))");
  if(IsPlayerInRangeOfPoint(playerid, 30.0,2460.5691,-2118.7847,13.5530))return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic]You are not at the mechanic HQ! ))");
  SendClientMessage(playerid, 0x3524C9FF, "(( [Mechanic] Vehicle repaired for $175! ))");
  GivePlayerMoney(playerid, -175);
  RepairVehicle(GetPlayerVehicleID(playerid));
  return 1;
}}
Reply
#2

is there any checkpoint, man please be more spacefic
Reply
#3

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 30.0,2460.5691,-2118.7847,13.5530))return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic]You are not at the mechanic HQ! ))");
Change that to

pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, 30.0,2460.5691,-2118.7847,13.5530))return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic]You are not at the mechanic HQ! ))");

Notice the !, it basically makes it....
pawn Код:
if(Something == 0)
When it would originally be
pawn Код:
if(Something == 1)
Reply
#4

Quote:
Originally Posted by [ABK]Antonio
Посмотреть сообщение
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 30.0,2460.5691,-2118.7847,13.5530))return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic]You are not at the mechanic HQ! ))");
Change that to

pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, 30.0,2460.5691,-2118.7847,13.5530))return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic]You are not at the mechanic HQ! ))");

Notice the !, it basically makes it....
pawn Код:
if(Something == 0)
When it would originally be
pawn Код:
if(Something == 1)
Now i got this error

Код:
C:\Users\x3990.003\Desktop\melfoef\samp server\filterscripts\Mechanic.pwn(223) : warning 203: symbol is never used: "repairvehicle"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#5

As i told you before, nothing is wrong with the code i gave you on your last topic, the coords are wrong.(read your pm's)
Reply
#6

Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
As i told you before, nothing is wrong with the code i gave you on your last topic, the coords are wrong.(read your pm's)
If that's the code you gave him, then it's wrong.


Quote:
Originally Posted by phantomcraft
Посмотреть сообщение
Now i got this error

Код:
C:\Users\x3990.003\Desktop\melfoef\samp server\filterscripts\Mechanic.pwn(223) : warning 203: symbol is never used: "repairvehicle"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Why do you have a repairvehicle variable? I don't see that in use/defined anywhere in this command.


EDIT: Ooooh....I see it now, do you have ZCMD or whatever you're using included?
Reply
#7

Not really, that's one problem but did if you'd look at the first post he also lost money which means the command works although he isn't in the range of point.
Reply
#8

Because he didn't use the NOT in the if statement. What the code did was to check if he is in range of that coordinates and stop the command there with a message.

On the command, it should be "RepairVehicle" as it's a function. Why do you need the "repairvehicle" variable for?
Reply
#9

Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
Not really, that's one problem but did if you'd look at the first post he also lost money which means the command works although he isn't in the range of point.
The problem is that he can do it anywhere. That's because it's checking if it's true...Meaning if he IS at the place, he wouldn't be able to do it. IsPlayerInRangeOfPoint will return 1 (true) if they're in range. It will return 0 (false) if they aren't. That's why I said to use ! which changes it from the default if(variable == 1) to if(variable == 0). Of course it should work aside from that. I can compile it perfectly fine the way it is, which is why I asked if he has ZCMD or whatever he's using included.
Reply
#10

If you don't check the >original post<, this would go'n forever,check my fixed code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)