CMD HELP !! +REP
#1

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

/afix [Playerid]


Can ANYONE Help Me Please ??
Reply
#2

SetVehicleHealth.

That took me less than 10 seconds to ******.
Reply
#3

Not the function i mean the CMD with the functions
Reply
#4

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

Код:
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");
}
Reply
#6

Thanks Guys +REP For both of You
Reply
#7

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)