Problem with fixcar command - 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)
+--- Thread: Problem with fixcar command (
/showthread.php?tid=407883)
Problem with fixcar command -
TheCancler - 15.01.2013
So I'm trying to make a simple /fixcar command and it is giving me this:
C:\Documents and Settings\Charles\Desktop\SA-MP Scripts\blank samp\gamemodes\grandlarc.pwn(490) : error 029: invalid expression, assumed zero
Line 490 is the line that 'else' is on.
Код:
//-----------------fixcar------------------------------
if(strcmp("/fixcar", cmdtext, true, 7) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
if IsPlayerInAnyVehicle(playerid) *then
SetVehicleHealth(vehicleid, 1000.0);
SendClientMessage(playerid, 0xFFFFFF, "Your car has been repaired.");
else
SendClientMessage(playerid, 0xFFFFFF, "You must be in a car to use this command.");
return 1;
}
I know it's a simple mistake but I can't figure out what I did wrong.
Re: Problem with fixcar command - Patrick - 15.01.2013
do it like this
pawn Код:
if(strcmp("/fixcar", cmdtext, true, 7) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_YELLOW,"You must be inside vehicle to use this command!");
RepairVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, 0xFFFFFF, "Your car has been repaired.");
return 1;
}
Re: Problem with fixcar command -
TheCancler - 15.01.2013
Same error.
Re: Problem with fixcar command - Patrick - 15.01.2013
try it again. edited
Re: Problem with fixcar command -
Infinity90 - 15.01.2013
pawn Код:
if(strcmp("/fixcar", cmdtext, true, 7) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
if IsPlayerInAnyVehicle(playerid)
{
SetVehicleHealth(vehicleid, 1000.0);
SendClientMessage(playerid, 0xFFFFFF, "Your car has been repaired.");
}
else
{
SendClientMessage(playerid, 0xFFFFFF, "You must be in a car to use this command.");
}
return 1;
}
Re: Problem with fixcar command -
TheCancler - 15.01.2013
Works, thank you.