VehRepair Command Problem
#1

I made a repair command wich cost 14500 but how to make it when i type /vehrepair the car repairs but i want after 2 minutes to type again with timer.How to do that!!
Reply
#2

Can SomeOne Help Me
Reply
#3

pawn Код:
new
    gVehDelay[ playerid ] = { -1, ... }
;

COMMAND:vehrepair( playerid, params[ ] )
{
    if ( !IsPlayerInAnyVehicle( playerid ) )
        return SendClientMessage( playerid, -1, "Silly boy, you are not in any vehicle." );

    if ( gVehDelay[ playerid ] != -1 )
        return SendClientMessage( playerid, -1, "Please wait before using the command again! Or pedobear will ate you." );
       
    if ( GetPlayerMoney( playerid ) < 14500 )
        return SendClientMessage( playerid, -1, "Not enough money. Kill a pedobear for money!" );

   RepairVehicle( GetPlayerVehicleID( playerid ) );

   gVehDelay[ playerid ] = 10;

   SetTimerEx( "useRepairAgain", 120000, false, "i", playerid );

   return 1;
}

forward useRepairAgain( playerid ); public useRepairAgain( playerid )
{
    gVehDelay[ playerid ] = -1;

    SendClientMessage( playerid, -1, "Now you can /repairveh your car again!" );

    return 1;
}
EDIT: [HiC]TheKiller was late :P
Reply
#4

pawn Код:
forward repair(playerid);

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/vehrepair", true))
    {
        if(GetPVarInt(playerid, "repair") == 1) return SendClientMessage(playerid, 0x008000FF, "You repaired in the last two minutes!");
        //.......
        SetPVarInt(playerid, "repair", 1);
        SetTimerEx("repair", 120000, false, "i", playerid);
        return 1;
    }
    return 0;
}

public repair(playerid)
{
    SetPVarInt(playerid, "repair", 0);
    return 1;
}
Reply
#5

The Killer Didnt work when i repair it repairs but when I repair second time it repair again I dont want to repair again i want to wate 2 minutes.
Reply
#6

Can SomeOne Help Me
Reply
#7

Did you try my code?

It should works fine....
Reply
#8

But I dont you zcmd and dcmd Or what is the command!!!
Reply
#9

Please stop double posting every 10 minutes, scripters have more things to do then just helping 1 member.
Give them some time and post per 5 hours or somthing, atleast not per 10 minutes.
Forum Rule is posting per 24 hours I thought, So watch it.
Reply
#10

OMFG, convert it to strcmp..... LAZY KID!
I bet a pedobear will ate you tomorrow.......
And a nyancat will annoy you when you sleep........

pawn Код:
new
    gVehDelay[ playerid ] = { -1, ... }
;

public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if ( !strcmp( cmdtext, "/vehrepair", true ) )
    {
        if ( !IsPlayerInAnyVehicle( playerid ) )
            return SendClientMessage( playerid, -1, "Silly boy, you are not in any vehicle." );

        if ( gVehDelay[ playerid ] != -1 )
            return SendClientMessage( playerid, -1, "Please wait before using the command again! Or pedobear will ate you." );
       
        if ( GetPlayerMoney( playerid ) < 14500 )
            return SendClientMessage( playerid, -1, "Not enough money. Kill a pedobear for money!" );

        RepairVehicle( GetPlayerVehicleID( playerid ) );

        gVehDelay[ playerid ] = 10;

        SetTimerEx( "useRepairAgain", 120000, false, "i", playerid );

        return 1;
    }

    return 0;
} // Ye I know, indentation sucks :D

forward useRepairAgain( playerid ); public useRepairAgain( playerid )
{
    gVehDelay[ playerid ] = -1;

    SendClientMessage( playerid, -1, "Now you can /repairveh your car again!" );

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)