SA-MP Forums Archive
CMD:hood (it was working before, not anymore) ;_; - 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: CMD:hood (it was working before, not anymore) ;_; (/showthread.php?tid=596285)



CMD:hood (it was working before, not anymore) ;_; - Ritzy2K - 15.12.2015

Hello, i made a command "hood" before, it was working before, but now it isnt working anymore.
Here's the command:
Код:
CMD:hood(playerid, params[])
{
	for (new i = 1; i != MAX_VEHICLES; i ++) if (IsValidVehicle(i) && IsPlayerNearHood(playerid, i))
	{
	    if (!IsDoorVehicle(i))
	        return SendClientMessage(playerid, -1,  "{FF0000}Error:{FFFFFF}This Vehicle Doesn't Have Hood.");

	    if (!GetHoodStatus(i))
		{
	        SetHoodStatus(i, true);
	        SendClientMessage(playerid, -1, "You Have {00FF40}Opened{FFFFFF} The Hood");		
		}
		else
		{
		SetHoodStatus(i, false);
		SendClientMessage(playerid, -1, "You Have {FF0000}Closed {FFFFFF}The Hood");			  
		}
	    return 1;
	}
	SendClientMessage(playerid, -1, "{FF0000}Error:{FFFFFF}You Are Not In Range Of Any Vehicle");
	return 1;
}
This does not shows any error or warnings.

This will work if m near or at a vehicle with no door. (i.e any bike).

But when im near any car which has door, or hood. It will simply say you're not in range of any vehicle.

it was working before as it is, but doesnt work now.


Re: CMD:hood (it was working before, not anymore) ;_; - ATGOggy - 15.12.2015

REMOVED


Re: CMD:hood (it was working before, not anymore) ;_; - Ritzy2K - 15.12.2015

Still need help though.


Re: CMD:hood (it was working before, not anymore) ;_; - Ritzy2K - 16.12.2015

Anyone? :/


Re: CMD:hood (it was working before, not anymore) ;_; - jlalt - 16.12.2015

PHP код:
CMD:hood(playeridparams[])
{
    for (new 
1!= MAX_VEHICLES++) if (IsValidVehicle(i) && IsPlayerNearHood(playeridi))
    {
        if (!
IsDoorVehicle(i))
            return 
SendClientMessage(playerid, -1,  "{FF0000}Error:{FFFFFF}This Vehicle Doesn't Have Hood.");
        if (!
GetHoodStatus(i))
        {
            
SetHoodStatus(itrue);
            
SendClientMessage(playerid, -1"You Have {00FF40}Opened{FFFFFF} The Hood");        
        }
        else
        {
        
SetHoodStatus(ifalse);
        
SendClientMessage(playerid, -1"You Have {FF0000}Closed {FFFFFF}The Hood");              
        }
    }
    else 
SendClientMessage(playerid, -1"{FF0000}Error:{FFFFFF}You Are Not In Range Of Any Vehicle");
    return 
1;

I wish this gonna work try it out


Re: CMD:hood (it was working before, not anymore) ;_; - Ritzy2K - 16.12.2015

No, m pretty sure this wont work. the loop isnt ending it will spam the message.

wait, let me test.

Yes, spammed my chat.


Re: CMD:hood (it was working before, not anymore) ;_; - jlalt - 16.12.2015

Quote:
Originally Posted by [ND]xXZeusXx.
Посмотреть сообщение
No, m pretty sure this wont work. the loop isnt ending it will spam the message.

wait, let me test.

Yes, spammed my chat.
would you tell me which message has spammed your chat?


Re: CMD:hood (it was working before, not anymore) ;_; - Ritzy2K - 16.12.2015

Код:
SendClientMessage(playerid, -1, "{FF0000}Error:{FFFFFF}You Are Not In Range Of Any Vehicle");
spam message = MAX_VEHICLES

for example, my max vehicle is 20, so this message comes 20 times.

(it came 305 times now though)


Re: CMD:hood (it was working before, not anymore) ;_; - jlalt - 16.12.2015

Quote:
Originally Posted by [ND]xXZeusXx.
Посмотреть сообщение
Код:
SendClientMessage(playerid, -1, "{FF0000}Error:{FFFFFF}You Are Not In Range Of Any Vehicle");
spam message = MAX_VEHICLES

for example, my max vehicle is 20, so this message comes 20 times.

(it came 305 times now though)
can you show me your IsPlayerNearHood?


Re: CMD:hood (it was working before, not anymore) ;_; - Ritzy2K - 16.12.2015

Код:
stock IsPlayerNearHood(playerid, vehicleid)
{
	static
		Float:fX,
		Float:fY,
		Float:fZ;

	GetVehicleHood(vehicleid, fX, fY, fZ);

	return (GetPlayerVirtualWorld(playerid) == GetVehicleVirtualWorld(vehicleid)) && IsPlayerInRangeOfPoint(playerid, 6.0, fX, fY, fZ);
}
i'm pretty sure this isn't the issue, because i use this stock in mechanic skill too. No issue there.

Quote:

This forum requires that you wait 120 seconds between posts. Please try again in 50 seconds.

kalkor pls