SA-MP Forums Archive
Boombox help again please - 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: Boombox help again please (/showthread.php?tid=353946)



Boombox help again please - San1 - 25.06.2012

Well the problem is i made it where players can only set 1 boombox
But it still keeps placing down boomboxes

the whole place cmd is here:
Код:
CMD:placeboombox(playerid, params[])
{
    if (PlayerInfo[playerid][pAlreadyBoombox] == 1)
    {
		SendClientMessage(playerid, COLOR_YELLOW, "You have already placed a boombox somewhere go /pickupboombox near it.");
		return 1;
	}
    if (PlayerInfo[playerid][pbuyBoombox] == 0)
    {
		SendClientMessage(playerid, COLOR_YELLOW, "You dont have a boombox - buy one from your local 24/7.");
		return 1;
	}
	else
	{
	    if (PlayerInfo[playerid][pbuyBoombox] == 1)
	    SendClientMessageEx(playerid, COLOR_YELLOW, "You have placed Boombox on the ground, /pickupboombox to remove it.");
	}
        GetPlayerPos(playerid,Positions[0][0], Positions[0][1], Positions[0][2]);
        SetPVarFloat(playerid, "DYN_Boombox_FLOAT_X", Positions[0][0]);
        SetPVarFloat(playerid, "DYN_Boombox_FLOAT_Y", Positions[0][1]);
        SetPVarFloat(playerid, "DYN_Boombox_FLOAT_Z", Positions[0][2]);
        PlayerInfo[playerid][pBoombox] = CreateDynamicObject(2103, Positions[0][0], Positions[0][1], Positions[0][2]-0.9, 0, 0, 3.9700012207031);
        ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
        ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
        SendClientMessageEx(playerid, COLOR_YELLOW, "you set the station use /turnonboombox - turn off using /turnoffboombox.");
    	return 1;
}
i have everything else working but that one problem is the first If thats called pAlreadyBoombox and if equals 1 u cannot set another if equals 0 u can set one but idk please help


Re: Boombox help again please - Kindred - 25.06.2012

Try this:

pawn Код:
CMD:placeboombox(playerid, params[])
{
    if (PlayerInfo[playerid][pAlreadyBoombox] == 1)
    {
        SendClientMessage(playerid, COLOR_YELLOW, "You have already placed a boombox somewhere go /pickupboombox near it.");
        return 1;
    }
    if (PlayerInfo[playerid][pbuyBoombox] == 0)
    {
        SendClientMessage(playerid, COLOR_YELLOW, "You dont have a boombox - buy one from your local 24/7.");
        return 1;
    }
    else
    {
        if (PlayerInfo[playerid][pbuyBoombox] == 1)
        SendClientMessageEx(playerid, COLOR_YELLOW, "You have placed Boombox on the ground, /pickupboombox to remove it.");
    }
    GetPlayerPos(playerid,Positions[0][0], Positions[0][1], Positions[0][2]);
    SetPVarFloat(playerid, "DYN_Boombox_FLOAT_X", Positions[0][0]);
    SetPVarFloat(playerid, "DYN_Boombox_FLOAT_Y", Positions[0][1]);
    SetPVarFloat(playerid, "DYN_Boombox_FLOAT_Z", Positions[0][2]);
    PlayerInfo[playerid][pBoombox] = CreateDynamicObject(2103, Positions[0][0], Positions[0][1], Positions[0][2]-0.9, 0, 0, 3.9700012207031);
    ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
    ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
    SendClientMessageEx(playerid, COLOR_YELLOW, "you set the station use /turnonboombox - turn off using /turnoffboombox.");
    PlayerInfo[playerid][pAlreadyBoombox] = 1;
    return 1;
}
You never set pAlreadyBoombox to 1.


Re: Boombox help again please - San1 - 25.06.2012

Thanks so much bro but i found out the problem already was gonna reply about it but u deserve +rep for an good reply