What am i doing wrong!!! -
NicholasA - 24.12.2012
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;
}}
Re: What am i doing wrong!!! -
GoldZoroGrab - 24.12.2012
is there any checkpoint, man please be more spacefic
Re: What am i doing wrong!!! -
[ABK]Antonio - 24.12.2012
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....
When it would originally be
Re: What am i doing wrong!!! -
NicholasA - 24.12.2012
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....
When it would originally be
|
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.
Re: What am i doing wrong!!! -
DaRk_RaiN - 24.12.2012
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)
Re: What am i doing wrong!!! -
[ABK]Antonio - 24.12.2012
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?
Re: What am i doing wrong!!! -
DaRk_RaiN - 24.12.2012
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.
Re: What am i doing wrong!!! -
Konstantinos - 24.12.2012
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?
Re: What am i doing wrong!!! -
[ABK]Antonio - 24.12.2012
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.
Re: What am i doing wrong!!! -
DaRk_RaiN - 24.12.2012
If you don't check the
>original post<, this would go'n forever,check my fixed code