SA-MP Forums Archive
Samp Object help - 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: Samp Object help (/showthread.php?tid=347800)



Samp Object help - San1 - 03.06.2012

Code:
if (strcmp("/parrot", cmdtext, true, 10) == 0)
	{
		SetPlayerAttachedObject(playerid,1, 19079, 1, 0.319503, -0.089340, -0.185576, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
		SendClientMessage(playerid, COLOR_RED, "You've Have gave urself an parrot");
		return 1;

	}
how i make it where i type /parrot the second time and it removes it and the next time i can put it on again


Re: Samp Object help - Legolas.W - 03.06.2012

Problem in anticheat.


Re: Samp Object help - iJumbo - 03.06.2012

you mean this ?

pawn Code:
new bool:parrot[MAX_PLAYERS];




if (strcmp("/parrot", cmdtext, true, 10) == 0)
{
    if(parrot[playerid] == false)
    {
        SetPlayerAttachedObject(playerid,1, 19079, 1, 0.319503, -0.089340, -0.185576, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
        SendClientMessage(playerid, COLOR_RED, "You've Have gave urself an parrot");
                parrot[playerid] == true;
    }
    else if(parrot[playerid] == true)
    {
        if(IsPlayerAttachedObjectSlotUsed(playerid, 1)) RemovePlayerAttachedObject(playerid,1);
        SendClientMessage(playerid, COLOR_RED, "You removed your parrot");
                parrot[playerid] == false;
    }
    return 1;
}
put
pawn Code:
new bool:parrot[MAX_PLAYERS];
top of your code ..


Re: Samp Object help - San1 - 03.06.2012

C:\Users\Debbie\Documents\Scripting\gamemodes\ls-dm.pwn(727) : warning 215: expression has no effect
C:\Users\Debbie\Documents\Scripting\gamemodes\ls-dm.pwn(734) : warning 215: expression has no effect


2 warnings

the warnings are these parrot[playerid] == false; and parrot[playerid] == true;

and the thing dont work it still dont take away the parrot i added it like this it still adds the parrot and dont take away

Code:
	new bool:parrot[MAX_PLAYERS];
 	if (strcmp("/parrot", cmdtext, true, 10) == 0)
{
    if(parrot[playerid] == false)
    {
        SetPlayerAttachedObject(playerid,0, 19079, 1, 0.319503, -0.089340, -0.185576, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
        SendClientMessage(playerid, COLOR_RED, "You've Have gave urself an parrot");
                parrot[playerid] == true;

    }
    else if(parrot[playerid] == true)
    {
        if(IsPlayerAttachedObjectSlotUsed(playerid, 0)) RemovePlayerAttachedObject(playerid,0);
        SendClientMessage(playerid, COLOR_RED, "You removed your parrot");
                parrot[playerid] == false;
    }
    	return 1;

	}



Re: Samp Object help - iJumbo - 03.06.2012

up sorry ..

change parrot[playerid] == true;
and parrot[playerid] == false;

to parrot[playerid] = true;
and parrot[playerid] = false;

and PUT the new boolarrot[MAX_PLAYERS]; At top of your script not at top of onplayercommandtext ..


Re: Samp Object help - Dan_Barocu - 04.06.2012

DELEtE.