What wrong with these code , help :(
#1

Code 1 :
PHP код:
CMD:layhangraxe(playeridparams[])
{
    new 
carid GetPlayerVehicleID(playerid),closestcar GetClosestCar(playeridcarid);
    if(
IsPlayerInRangeOfVehicle(playeridclosestcar6.0) && IsAMatsCar(closestcar))
    {
        new 
engine,lights,alarm,doors,bonnet,boot,objective;
        
GetVehicleParamsEx(closestcar,engine,lights,alarm,doors,bonnet,boot,objective);
        if(
boot == VEHICLE_PARAMS_OFF || boot == VEHICLE_PARAMS_UNSET)
        {
            
SendClientMessageEx(playeridCOLOR_GRAD1"Cop cua chiec xe can duoc mo.");
            return 
1;
        }
        if(
PlayerInfo[playerid][pWins] == 0)
        return 
SendClientMessageEx(playeridCOLOR_GREEN" Ban chua dat hang len chiec xe ");
        if(
PlayerInfo[playerid][pWins] = 1)
        {
        
ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
        
ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
           
PlayerInfo[playerid][pHeroin] = 1;
        
PlayerInfo[playerid][pWins] = 0;
        
ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
         
ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
         
ApplyAnimation(playerid"CARRY""crry_prtial"4.011111);
        
SendClientMessageEx(playerid,COLOR_GREY," Ban dang lay hang ra khoi xe !");
        
SetPlayerAttachedObjectplayerid038001, -0.0646130.5207600.0000000.00000084.2173910.0000001.0000001.0000001.000000 );
        }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GRAD1"Ban khong gan mot chiec xe cho vat lieu.");
    }
    }
    return 
1;

Code 2 :
PHP код:
CMD:dathanglenxe(playeridparams[])
{
    if(
PlayerInfo[playerid][pPaper] < 1)
    {
        
SendClientMessageEx(playerid,COLOR_GREY," Ban chua lay hang hoa de len xe !");
    }
    new 
carid GetPlayerVehicleID(playerid),closestcar GetClosestCar(playeridcarid);
    if(
IsPlayerInRangeOfVehicle(playeridclosestcar6.0) && IsAMatsCar(closestcar))
    {
        new 
engine,lights,alarm,doors,bonnet,boot,objective;
        
GetVehicleParamsEx(closestcar,engine,lights,alarm,doors,bonnet,boot,objective);
        if(
boot == VEHICLE_PARAMS_OFF || boot == VEHICLE_PARAMS_UNSET)
        {
            
SendClientMessageEx(playeridCOLOR_GRAD1"Cop cua chiec xe can duoc mo.");
            return 
1;
        }
        
PlayerInfo[playerid][pWins] = 1;
        
ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
        
ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
        for(new 
x;x<MAX_PLAYERTOYS;x++)
        {
        
RemovePlayerAttachedObject(playeridx);
        }
    }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GRAD1"Ban khong gan mot chiec xe cho vat lieu.");
    }
    }
    return 
1;

please help
Reply
#2

bump
please help
Reply
#3

Two closing brackets at the end. Next time, please provide more info into what is happening.

The code is not English, so we have no idea what we are looking for.
Reply
#4

What do u mean ? this code is english, just words i put in in case ( ) are vietnamese.
Reply
#5

Try indenting better, makes it easier for you to see your mistakes then, you've got two closing brackets like mamorunl said.

Also post your errors here if you get some, and if you don't just tell us you don't have any errors.
Reply
#6

I'm not sure.. i dunno how to fix about brackets so im posted here.
My error : it make my pawn crashed
Reply
#7

Код:
CMD:layhangraxe(playerid, params[])
{
	new carid = GetPlayerVehicleID(playerid),closestcar = GetClosestCar(playerid, carid);
	if(IsPlayerInRangeOfVehicle(playerid, closestcar, 6.0) && IsAMatsCar(closestcar))
	{
		new engine,lights,alarm,doors,bonnet,boot,objective;
		GetVehicleParamsEx(closestcar,engine,lights,alarm,doors,bonnet,boot,objective);
		if(boot == VEHICLE_PARAMS_OFF || boot == VEHICLE_PARAMS_UNSET)
		{
			SendClientMessageEx(playerid, COLOR_GRAD1, "Cop cua chiec xe can duoc mo.");
			return 1;
		}
		if(PlayerInfo[playerid][pWins] == 0)
		return SendClientMessageEx(playerid, COLOR_GREEN, " Ban chua dat hang len chiec xe ");
		if(PlayerInfo[playerid][pWins] = 1)
		{
			ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
			ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
			PlayerInfo[playerid][pHeroin] = 1;
			PlayerInfo[playerid][pWins] = 0;
			ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
			ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
			ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 1, 1, 1, 1, 1);
			SendClientMessageEx(playerid,COLOR_GREY," Ban dang lay hang ra khoi xe !");
			SetPlayerAttachedObject( playerid, 0, 3800, 1, -0.064613, 0.520760, 0.000000, 0.000000, 84.217391, 0.000000, 1.000000, 1.000000, 1.000000 );
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GRAD1, "Ban khong gan mot chiec xe cho vat lieu.");
		}
	}
	return 1;
}
Код:
CMD:dathanglenxe(playerid, params[])
{
	if(PlayerInfo[playerid][pPaper] < 1)
	{
		SendClientMessageEx(playerid,COLOR_GREY," Ban chua lay hang hoa de len xe !");
	}
	new carid = GetPlayerVehicleID(playerid),closestcar = GetClosestCar(playerid, carid);
	if(IsPlayerInRangeOfVehicle(playerid, closestcar, 6.0) && IsAMatsCar(closestcar))
	{
		new engine,lights,alarm,doors,bonnet,boot,objective;
		GetVehicleParamsEx(closestcar,engine,lights,alarm,doors,bonnet,boot,objective);
		if(boot == VEHICLE_PARAMS_OFF || boot == VEHICLE_PARAMS_UNSET)
		{
			SendClientMessageEx(playerid, COLOR_GRAD1, "Cop cua chiec xe can duoc mo.");
			return 1;
		}
		PlayerInfo[playerid][pWins] = 1;
		ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
		ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
		for(new x;x<MAX_PLAYERTOYS;x++)
		{
			RemovePlayerAttachedObject(playerid, x);
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "Ban khong gan mot chiec xe cho vat lieu.");
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)