Zcmd command
#1

Код:
CMD:autotunecar(playerid,params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid,COLOR_LIGHTRED, "Logheazate mai intai");
	if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER ) return SendClientMessage(playerid,COLOR_GRAD3,"Intai trebuie sa fi intr-o masina ");
	if(PlayerInfo[playerid][pAdmin] > 2 )
	{
		if( GetVehicleModel(playerid,GetPlayerVehicleID(playerid)) == 411)
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
			AddVehicleComponent(GetPlayerVehicleID(playerid), 1083);
			SendClientMessage(playerid,-1,"Masina a fost tunata");
		}
		else if(GetVehicleModel(playerid,GetPlayerVehicleID(playerid)) == 560)
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
			AddVehicleComponent(GetPlayerVehicleID(playerid), 1026);
			AddVehicleComponent(GetPlayerVehicleID(playerid), 1027);
			AddVehicleComponent(GetPlayerVehicleID(playerid), 1033);
			SendClientMessage(playerid,-1,"Masina a fost tunata");
		}
		else
		{
			SendClientMessage(playerid,-1,"Alege un infernus / sultan");
		}
	}
	else
	{
		SendClientMessage(playerid,-1,AdminOnly);
	}
	return 1;
}
Well , when I get in the infernus or sultan it shows me the SendClientMessage instead of tuning the car .
Reply
#2

You shouldn't ignore warnings, you got at least two warnings for wrong number of arguments in these two lines:
pawn Код:
if( GetVehicleModel(playerid,GetPlayerVehicleID(playerid)) == 411)
else if(GetVehicleModel(playerid,GetPlayerVehicleID(playerid)) == 560)
GetVehicleModel has one parameter and that is "vehicleid". Use switch to avoid calling GetVehicleModel and GetPlayerVehicleID ~4 times.
pawn Код:
switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
{
    case 411:
    {
        // infernus
    }
    case 560:
    {
        // sultan
    }
    default: SendClientMessage(playerid,-1,"Alege un infernus / sultan");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)