SA-MP Forums Archive
CMD HELP !! +REP - 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: CMD HELP !! +REP (/showthread.php?tid=584426)



CMD HELP !! +REP - DreaM1 - 04.08.2015

guys I need an Admin CMd that Fixes Player's Vehicle Like :-

/afix [Playerid]


Can ANYONE Help Me Please ??


Re: CMD HELP !! +REP - Sithis - 04.08.2015

SetVehicleHealth.

That took me less than 10 seconds to ******.


Re: CMD HELP !! +REP - DreaM1 - 04.08.2015

Not the function i mean the CMD with the functions


Re: CMD HELP !! +REP - Fancy - 04.08.2015

Put this at top of the script
Код:
#include <sscanf2>
And there is the command
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/afix", cmdtext, true, 10) == 0)
	{
		new id,str[265];
		if(!IsPlayerAdmin(playerid)) return 0;
		if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFFFFFFFF, "Enter a valid player id");
		if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFFFFFFFF, "Player is not connected");
		if(GetPlayerState(id) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, 0xFFFFFFFF, "The player is not driving a vehicle");
        if(sscanf(cmdtext,"u",id)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /afix (playerid)");
		new vehicleid = GetPlayerVehicleID(id);
		RepairVehicle(vehicleid);
		format(str,sizeof(str),"You fixed %s(%d) vehicle",GetName(id), id);
		SendClientMessage(playerid, 0xFFFFFFFF, str);
		return 1;
	}
	return 0;
}



Re: CMD HELP !! +REP - HydraHumza - 04.08.2015

Код:
CMD:afix(playerid,params[]) {
    if(IsPlayerAdmin(playerid)) {
        new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
        player1 = strval(params);
            if (IsPlayerInAnyVehicle(player1)) {
                RepairVehicle(GetPlayerVehicleID(player1));
                SetVehicleHealth(GetPlayerVehicleID(player1), 1000);
                CMDMessageToAdmins(playerid,"AFIX");
                GetPlayerName(player1, playername, sizeof(playername));     GetPlayerName(playerid, adminname, sizeof(adminname));
                format(string,sizeof(string),"Admin %s Fixed your vehicle.",adminname); SendClientMessage(player1,blue,string);
                format(string,sizeof(string),"You have fixed %s's vehicle.", playername);
                return SendClientMessage(playerid, -1,string);
            } else return SendClientMessage(playerid,red,"Error: This player isn't in a vehicle");
    } else return SendClientMessage(playerid,red,"ERROR: You need to be an admin to use this command");
}



Re: CMD HELP !! +REP - DreaM1 - 04.08.2015

Thanks Guys +REP For both of You


Re: CMD HELP !! +REP - SpikeSpigel - 04.08.2015

He will never learn pawno if you continue to give him the code finished -.-


Re: CMD HELP !! +REP - Sithis - 05.08.2015

Quote:
Originally Posted by DreaM1
Посмотреть сообщение
Not the function i mean the CMD with the functions
If you bothered to actually search with ******, you would have found the entire code at the ready.