SA-MP Forums Archive
Hello Im Lost - 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: Hello Im Lost (/showthread.php?tid=294069)



Hello Im Lost - Buzzbomb - 31.10.2011

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



Re: Hello Im Lost - AsiansRoleplayOwner - 31.10.2011

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


Re: Hello Im Lost - Buzzbomb - 31.10.2011

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


Re: Hello Im Lost - Babul - 31.10.2011

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



Re: Hello Im Lost - Norn - 31.10.2011

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