CMD errors
#1

warning 209: function "cmd_placeboombox" should return a value
error 010: invalid function or declaration

THE CMD
Код:
CMD:placeboombox(playerid, params[])
{
	    if(GetPVarInt(playerid, "IsInArena") >= 0) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while being in an arena!");
		if(WatchingTV[playerid] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can not do this while watching TV!");
		if(GetPVarInt(playerid, "Injured") == 1 || PlayerInfo[playerid][pHospital] == 1 || IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now.");
		if(GetPVarType(playerid, "pDynamicBB")) return SendClientMessageEx(playerid, COLOR_WHITE, "You already have a boombox out, use /pickupboombox.");

		foreach(Player, i)
	    {
	        if(GetPVarType(i, "pDynamicBB"))
	        {
    			if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "pDynamicBBX"), GetPVarFloat(i, "pDynamicBBY"), GetPVarFloat(i, "pDynamicBBZ")))
				{
				    SendClientMessage(playerid, COLOR_WHITE, "You are in range of another boombox, you can't place one here!");
				    return 1;
				}
			}
		}
		new string[128];
		format(string, sizeof(string), "%s has placed a boombox!", GetPlayerNameEx(playerid));
	    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

	    new Float:x, Float:y, Float:z, Float:a;
	    GetPlayerPos(playerid, x, y, z);
	    GetPlayerFacingAngle(playerid, a);
	    ApplyAnimation(playerid,"BOMBER","BOM_Plant_Crouch_In", 4.0, 0, 0, 0, 0, 0, 1);
	    x += (2 * floatsin(-a, degrees));
    	y += (2 * floatcos(-a, degrees));
    	z -= 1.0;

	  	SetPVarInt(playerid, "pDynamicBB", CreateDynamicObject(2226, x, y, z, 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
        SetPVarFloat(playerid, "pDynamicBBX", x); SetPVarFloat(playerid, "pDynamicBBY", y); SetPVarFloat(playerid, "pDynamicBBZ", z);
        format(string, sizeof(string), "{00FF00}Boombox Owner:{FFFFFF}%s\n{FF0000}/setboombox{FFFFFF} to set your boombox \n{FFFF00}or\n{FF0000}/pickupboombox{FFFFFF}", SenderName(playerid));
        SetPVarInt(playerid, "pDynamicBBLabel", _:CreateDynamic3DTextLabel(string, COLOR_WHITE, x, y, z+0.6, 5.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
        SetPVarInt(playerid, "pDynamicBBArea", CreateDynamicSphere(x, y, z, 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
        SetPVarInt(playerid, "pDynamicBBInt", GetPlayerInterior(playerid));
        SetPVarInt(playerid, "pDynamicBBVW", GetPlayerVirtualWorld(playerid));
	}
	return 1;
}
WHAT TO DO ?
Reply
#2

Where is the line of that error?Use PHP code and use "// this is the line of that error"
Reply
#3

I fixed only the warning, I don't know where the error's line is located and which is.
I will edit my post when you tell us the line!
pawn Код:
CMD:placeboombox(playerid, params[])
{
    if(GetPVarInt(playerid, "IsInArena") >= 0) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while being in an arena!");
    if(WatchingTV[playerid] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can not do this while watching TV!");
    if(GetPVarInt(playerid, "Injured") == 1 || PlayerInfo[playerid][pHospital] == 1 || IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now.");
    if(GetPVarType(playerid, "pDynamicBB")) return SendClientMessageEx(playerid, COLOR_WHITE, "You already have a boombox out, use /pickupboombox.");

    foreach(Player, i)
    {
        if(GetPVarType(i, "pDynamicBB"))
        {
            if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "pDynamicBBX"), GetPVarFloat(i, "pDynamicBBY"), GetPVarFloat(i, "pDynamicBBZ")))
            {
                SendClientMessage(playerid, COLOR_WHITE, "You are in range of another boombox, you can't place one here!");
                return 1;
            }
        }
    }
    new string[128];
    format(string, sizeof(string), "%s has placed a boombox!", GetPlayerNameEx(playerid));
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

    new Float:x, Float:y, Float:z, Float:a;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, a);
    ApplyAnimation(playerid,"BOMBER","BOM_Plant_Crouch_In", 4.0, 0, 0, 0, 0, 0, 1);
    x += (2 * floatsin(-a, degrees));
    y += (2 * floatcos(-a, degrees));
    z -= 1.0;

    SetPVarInt(playerid, "pDynamicBB", CreateDynamicObject(2226, x, y, z, 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
    SetPVarFloat(playerid, "pDynamicBBX", x); SetPVarFloat(playerid, "pDynamicBBY", y); SetPVarFloat(playerid, "pDynamicBBZ", z);
    format(string, sizeof(string), "{00FF00}Boombox Owner:{FFFFFF}%s\n{FF0000}/setboombox{FFFFFF} to set your boombox \n{FFFF00}or\n{FF0000}/pickupboombox{FFFFFF}", SenderName(playerid));
    SetPVarInt(playerid, "pDynamicBBLabel", _:CreateDynamic3DTextLabel(string, COLOR_WHITE, x, y, z+0.6, 5.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
    SetPVarInt(playerid, "pDynamicBBArea", CreateDynamicSphere(x, y, z, 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
    SetPVarInt(playerid, "pDynamicBBInt", GetPlayerInterior(playerid));
    SetPVarInt(playerid, "pDynamicBBVW", GetPlayerVirtualWorld(playerid));
    return 1;
}
Reply
#4

Код:
CMD:placeboombox(playerid, params[])
{
	    if(GetPVarInt(playerid, "IsInArena") >= 0) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while being in an arena!");
		if(WatchingTV[playerid] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can not do this while watching TV!");
		if(GetPVarInt(playerid, "Injured") == 1 || PlayerInfo[playerid][pHospital] == 1 || IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now.");
		if(GetPVarType(playerid, "pDynamicBB")) return SendClientMessageEx(playerid, COLOR_WHITE, "You already have a boombox out, use /pickupboombox.");

		foreach(Player, i)
	    {
	        if(GetPVarType(i, "pDynamicBB"))
	        {
    			if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "pDynamicBBX"), GetPVarFloat(i, "pDynamicBBY"), GetPVarFloat(i, "pDynamicBBZ")))
				{
				    SendClientMessage(playerid, COLOR_WHITE, "You are in range of another boombox, you can't place one here!");
				    return 1;
				}
			}
		}
		new string[128];
		format(string, sizeof(string), "%s has placed a boombox!", GetPlayerNameEx(playerid));
	    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

	    new Float:x, Float:y, Float:z, Float:a;
	    GetPlayerPos(playerid, x, y, z);
	    GetPlayerFacingAngle(playerid, a);
	    ApplyAnimation(playerid,"BOMBER","BOM_Plant_Crouch_In", 4.0, 0, 0, 0, 0, 0, 1);
	    x += (2 * floatsin(-a, degrees));
    	y += (2 * floatcos(-a, degrees));
    	z -= 1.0;

	  	SetPVarInt(playerid, "pDynamicBB", CreateDynamicObject(2226, x, y, z, 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
        SetPVarFloat(playerid, "pDynamicBBX", x); SetPVarFloat(playerid, "pDynamicBBY", y); SetPVarFloat(playerid, "pDynamicBBZ", z);
        format(string, sizeof(string), "{00FF00}Boombox Owner:{FFFFFF}%s\n{FF0000}/setboombox{FFFFFF} to set your boombox \n{FFFF00}or\n{FF0000}/pickupboombox{FFFFFF}", SenderName(playerid));
        SetPVarInt(playerid, "pDynamicBBLabel", _:CreateDynamic3DTextLabel(string, COLOR_WHITE, x, y, z+0.6, 5.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
        SetPVarInt(playerid, "pDynamicBBArea", CreateDynamicSphere(x, y, z, 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
        SetPVarInt(playerid, "pDynamicBBInt", GetPlayerInterior(playerid));
        SetPVarInt(playerid, "pDynamicBBVW", GetPlayerVirtualWorld(playerid));
	}
//ERROR HERE	return 1;
}
Reply
#5

I guessed correct, you're using a close bracket "}" before return 1; which is pointless and that caused the error and the warning. Use my code above.
Reply
#6

Thanks for the help + Rep for ya
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)