Hello Im Lost
#1

I tried to make a command to heal all cars it was a massive failure...

It code went thru but vehicles never got healed.. I tried to blow them up see if i can crash the server but really i trying to make a command to heal all cars just for special days heh..

Any pointers

Here the code...

pawn Код:
CMD:healallcars(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] < 10) SendClientMessage(playerid, ERROR, "Your Not Authorized");
    else {
        new Float:amount;
        if(sscanf(params,"i",amount)) SendClientMessage(playerid, WARNING, "Command Didnt Work.. Or did Just remove this warning");
        else {
            if(amount < 0 || amount > 1000) SendClientMessage(playerid, WARNING, "UM Didnt Work Try 0 or 1000");
            else {
                new veh = GetPlayerVehicleID(veh);
                SetVehicleHealth(veh, amount);
                new string[256];
                new adminname[MAX_PLAYER_NAME];
                GetPlayerName(playerid, adminname, sizeof(adminname));
                format(string, 256, "%s(%d) has set All Cars Too %.1f.", adminname,playerid,amount);
                PlayerAnn(GREEN,string, 5);
            }
        }
    }
    return 1;
}
Reply
#2

Where u get this pawn?
Have you try to compile it?
Reply
#3

Um its in my gamemode wrote by looking at healplayer code ... and it compile fine just dont work
Reply
#4

try this
Код:
CMD:healallcars(playerid, params[])
{
	if(PlayerInfo[playerid][pAdminLevel] < 10) SendClientMessage(playerid, ERROR, "Your Not Authorized");
	else
	{
		new Float:amount;
		if(sscanf(params,"F(1000.0)",amount)) SendClientMessage(playerid, WARNING, "Use /HealAllCars <Float:Amount (0-1000)>");
		else 
		{
			for (new id=0;id<MAX_PLAYERS;id++)
			{
				new veh = GetPlayerVehicleID(id);
				if(veh>0)
				{
					SetVehicleHealth(veh, amount);
				}
			}
			new adminname[MAX_PLAYER_NAME];
			GetPlayerName(playerid, adminname, sizeof(adminname));
			new string[256];
			format(string, 256, "%s(%d) has set All Cars Too %.1f.", adminname,playerid,amount);
			PlayerAnn(GREEN,string, 5);
		}
	}
	return 1;
}
Reply
#5

pawn Код:
public SetAllVehicleHealth(Float:newhealth)
{
    for(new i = 0; i < MAX_VEHICLES; i++) {
        new Float:pos[3];
        GetVehiclePos(i, pos[0], pos[1], pos[2]);
        if(pos[0] != 0.0 && pos[1]!= 0.0 && pos[2] != 0.0)  {
            SetVehicleHealth(i, newhealth);
        }
    }
    return true;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)