SA-MP Forums Archive
/repair 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: /repair command (/showthread.php?tid=336859)



/repair command - sscarface - 23.04.2012

i want i add /repair command on [GameMode]RuNix's Cops And Robbers


can u give me /repair cmd


Re: /repair command - 2KY - 23.04.2012

pawn Код:
CMD:repair ( playerid, params[ ] )
{
    if( IsPlayerInAnyVehicle ( playerid ) )
    {
        RepairVehicle( GetPlayerVehicleID ( playerid ) );
        SendClientMessage ( playerid, -1, "* Your vehicle has been repaired!" );
       
        //GivePlayerMoney ( playerid, -100 ), GameTextForPlayer ( playerid, 1, 1000, "~r~-~g~$100" );
        // You can uncomment this line ^ if you wish to make it cost $100 (or change the value)
    }
    else
    {
        return SendClientMessage ( playerid, -1, "ERROR: You're not inside of a vehicle!" );
    }
    return true;
}
Here you are.


Re: /repair command - sscarface - 23.04.2012

C:\DOCUME~1\BALOCH\MYDOCU~1\DOWNLO~1\SAMP03~1\COPS AN~1.PWN(9825) : warning 203: symbol is never used: "repair"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


this error


Re: /repair command - 2KY - 23.04.2012

What command processor do you use? dini? strcmp?

If you use strcmp, use this;

pawn Код:
if (strcmp("/repair", cmdtext, true, 7) == 0)
    {
        if( IsPlayerInAnyVehicle ( playerid ) )
        {
            RepairVehicle( GetPlayerVehicleID ( playerid ) );
            SendClientMessage ( playerid, -1, "* Your vehicle has been repaired!" );

            // GivePlayerMoney ( playerid, -100 ), GameTextForPlayer ( playerid, 1, 1000, "~r~-~g~$100" );
            // You can uncomment this line ^ if you wish to make it cost $100 (or change the value)
        }
        else
        {
            return SendClientMessage ( playerid, -1, "ERROR: You're not inside of a vehicle!" );
        }
        return true;
    }
Be sure to place it under OnPlayerCommandText.


Re: /repair command - sscarface - 24.04.2012

dcmd(refuel,6,cmdtext);


Re: /repair command - sscarface - 24.04.2012

this is my gm refuel cmd

Код:
dcmd_refuel(playerid,params[]){
	#pragma unused params
	if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid)){
		if(IsAtFuelStation(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
			new vehicleid = GetPlayerVehicleID(playerid);
			if(Speed[playerid][Refueling] == 0){
				if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessage(playerid,COLOR_YELLOW,".:: [ERROR]: This vehicle does not need fuel :.");
				if(Vehicle[vehicleid][Fuel] >= 100){
					SendClientMessage(playerid,COLOR_YELLOW,".:: [FUEL]: Your gas tank is already full.");
				} else {
    				Vehicle[GetPlayerVehicleID(playerid)][OldFuel] = 0; Speed[playerid][Refueling] = 1;
					Speed[playerid][ReFuelTimer] = SetTimerEx("ReFill", 1000, true, "i", playerid); }
			} else { SendClientMessage(playerid,COLOR_YELLOW,".:: [FUEL]: You are allready refueling your car."); }
		} else { SendClientMessage(playerid,COLOR_YELLOW,".:: [FUEL]: You must be at a gas station to refuel"); } }
	return true;
}



Re: /repair command - 2KY - 24.04.2012

Quote:
Originally Posted by sscarface
Посмотреть сообщение
dcmd(refuel,6,cmdtext);
I believe strcmp & dcmd are compatible.

pawn Код:
dcmd_repair(playerid,params[]){
    {
        if( IsPlayerInAnyVehicle ( playerid ) )
        {
            RepairVehicle( GetPlayerVehicleID ( playerid ) );
            SendClientMessage ( playerid, -1, "* Your vehicle has been repaired!" );

            // GivePlayerMoney ( playerid, -100 ), GameTextForPlayer ( playerid, 1, 1000, "~r~-~g~$100" );
            // You can uncomment this line ^ if you wish to make it cost $100 (or change the value)
        }
        else
        {
            return SendClientMessage ( playerid, -1, "ERROR: You're not inside of a vehicle!" );
        }
        return true;
    }
Here you are.


Re: /repair command - sscarface - 24.04.2012

much error


Re: /repair command - diego_p11 - 24.04.2012

Quote:
Originally Posted by sscarface
Посмотреть сообщение
much error
errors or warnings? because if they are warnings dont matter much as errors, even if u get warning, ur gm get compiled.


Re: /repair command - Yuryfury - 24.04.2012

add dcmd(repair,6,cmdtext); under dcmd(refuel,6,cmdtext);.

Paste this at the bottom of your script:

pawn Код:
dcmd_repair(playerid, params[])
{
    #pragma unused params
    if(IsPlayerInAnyVehicle(playerid))
    {
        RepairVehicle(GetPlayerVehicleID(playerid));
        SendClientMessage(playerid,0xFFFF00AA,"Server: Your Vehicle Has Been Repaired!");
    }
    return 1;
}