SA-MP Forums Archive
Why doesnt this work? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Why doesnt this work? (/showthread.php?tid=246492)



Why doesnt this work? - Gemini - 04.04.2011

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp("/repair", cmdtext))
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
        RepairVehicle(GetPlayerVehicleID(playerid));
        SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
        return 1;
    }
}
I've copied it directly from wiki sa, and even tho the script gives me no errors when i compile, command /repair does not repair my vehicles visable damage.
Help please.


Re: Why doesnt this work? - Gray - 04.04.2011

maybe ur callback's parameter isnt the same as the cmd

try
Код:
if(!strcmp("/repair", cmdtext, true))



Re: Why doesnt this work? - bijoyekuza - 04.04.2011

try
if(strcmp(cmdtext,"/repair",true) == 0)


Re: Why doesnt this work? - Gemini - 04.04.2011

Both
Код:
if(strcmp(cmdtext,"/fix",true) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
        RepairVehicle(GetPlayerVehicleID(playerid));
        SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
        return 1;
    }
and

Код:
if(!strcmp("/repair", cmdtext, true))
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
        RepairVehicle(GetPlayerVehicleID(playerid));
        SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
        return 1;
    }
Do not work. The engine damage gets fixed, but the damage such as broken doors or bumpers doesnt..


Re: Why doesnt this work? - Gemini - 04.04.2011

Somebody??


Re: Why doesnt this work? - Sascha - 04.04.2011

may I ask which SA-MP version you have?
as far as I know "RepairVehicle(ID)" is fixing the whole vehicle (visual and physical damage) since version 0.2 or so...
it sounds as if you have an old version