Problem with fixcar command
#1

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.
Reply
#2

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;
        }
Reply
#3

Same error.
Reply
#4

try it again. edited
Reply
#5

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;
}
Reply
#6

Works, thank you.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)