/repair command
#1

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


can u give me /repair cmd
Reply
#2

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

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
Reply
#4

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

dcmd(refuel,6,cmdtext);
Reply
#6

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

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

much error
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)