[FilterScript] Comand repair vehicle don't work...
#1

Hi all, sorry if the section is wrong. I have the command to repair the vehicles in SA-MP, but don't repair, that I write /fix and send me the message Fixed Vehicle, but the car does not repair the damage left with ... know how? here's the code pawn and sorry my English i'm italian.


if ( strcmp ( cmdtext , "/fix", true)==0)
{
new State=GetPlayerState(playerid);
if (IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
{

RepairVehicle(vehicleid);
SendClientMessage(playerid,COLOR_GREEN,"Vehicle Fixed!");
}
else
{
SendClientMessage(playerid,COLOR_BLUE,"You aren't in any vehicle.");
}
return 1;
}
Reply
#2

Код:
if ( strcmp ( cmdtext , "/fix", true)==0)
{
new State=GetPlayerState(playerid);
if (IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
{
new veh=GetPlayerVehicleID(playerid);
RepairVehicle(veh);
SendClientMessage(playerid,COLOR_GREEN,"Vehicle Fixed!");
}
else
{
SendClientMessage(playerid,COLOR_BLUE,"You aren't in any vehicle.");
}
return 1;
}
Reply
#3

Wrong section
Reply
#4

Indent your code. You can read it better.

pawn Код:
if(!strcmp(cmdtext, "/fix", true))
{
    if(IsPlayerInAnyVehicle(playerid) || GetPlayerState(playerid, PLAYER_STATE_DRIVER)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        RepairVehicle(vehicleid);
        SendClientMessage(playerid, COLOR_GREEN, "You have fixed your vehicle!");
    }
    else
    {
        SendClientMessage(playerid, COLOR_BLUE, "You are not in a vehicle.");
    }
    return 1;
}
Reply
#5

I run this REPAIR line at the moment and it works great you may use it if you want:

pawn Код:
if(strcmp(cmdtext, "/vr", true) == 0 || strcmp(cmdtext, "/repair", true) == 0)
    {
   
    if(IsPlayerInAnyVehicle(playerid))
    {
       RepairVehicle(GetPlayerVehicleID(playerid));
       SendClientMessage(playerid,0xC0C0C0AA,"Car is ful repaird");


    } else SendClientMessage(playerid,0xC0C0C0AA,"You have not got a vehicle!");

    return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)