Problem with my code
#1

Hello guys

I have made this faction vehicle system, so that whenever your skin is not the valid one, you'll be frozen. But I'd want it to apply animation or simply just deny access.. But whenever i put my code in it simply freezes the person, who does not have the right skin. It even freezes the person if i remove the codes! Unless they have the skin

This is what i tried

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) {
	if(vehicleid == 416)
	{
 	if(GetPlayerSkin(playerid) == 274 || GetPlayerSkin(playerid) == 275 || GetPlayerSkin(playerid) == 276)
 	{
	RemovePlayerFromVehicle(playerid);
	SendClientMessage(playerid,0xFFFF00AA," You're not an EMS!");
 	return 1;
	}
	else
	{
    SendClientMessage(playerid,0xFFFF00AA," You just entered the ambulance!");
    }
	}
	return 1;
	}
Reply
#2

Quote:
Originally Posted by ChristofferHoffmann
Посмотреть сообщение
Hello guys

I have made this faction vehicle system, so that whenever your skin is not the valid one, you'll be frozen. But I'd want it to apply animation or simply just deny access.. But whenever i put my code in it simply freezes the person, who does not have the right skin. It even freezes the person if i remove the codes! Unless they have the skin

This is what i tried

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) {
	if(vehicleid == 416)
	{
 	if(GetPlayerSkin(playerid) == 274 || GetPlayerSkin(playerid) == 275 || GetPlayerSkin(playerid) == 276)
 	{
	RemovePlayerFromVehicle(playerid);
	SendClientMessage(playerid,0xFFFF00AA," You're not an EMS!");
 	return 1;
	}
	else
	{
    SendClientMessage(playerid,0xFFFF00AA," You just entered the ambulance!");
    }
	}
	return 1;
	}
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) {
    if(vehicleid == 416)
    {
    if(GetPlayerSkin(playerid) != 274 || GetPlayerSkin(playerid) != 275 || GetPlayerSkin(playerid) != 276)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid,0xFF0000AA, "You're not an EMS!");
        TogglePlayerControllable(playerid, 1);
    return 1;
    }
    else return SendClientMessage(playerid,0xFF0000AA," You just entered the ambulance!");
    }
    return 1;
    }
Reply
#3

Quote:
Originally Posted by Threshold
Посмотреть сообщение
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) {
    if(vehicleid == 416)
    {
    if(GetPlayerSkin(playerid) != 274 || GetPlayerSkin(playerid) != 275 || GetPlayerSkin(playerid) != 276)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid,0xFF0000AA, "You're not an EMS!");
        TogglePlayerControllable(playerid, 1);
    return 1;
    }
    else return SendClientMessage(playerid,0xFF0000AA," You just entered the ambulance!");
    }
    return 1;
    }
Hey, i just tried the code. But it still just freezes you, if you do not have the skin (he doesn't even go into the ambulance, but as you press F you have to unfreeze with admin command)

Do you know a way, i can make it unfreeze automaticly after like 2-3 seconds? I suppose, i can make it TogglePlayerControllable(playerid, 0); to apply the freeze, and then afterwards TogglePlayerControllable(playerid, 1); ?

I really appreciate your time, merry christmas
Reply
#4

You can Just use RemovePlayerFromVehicle ?
Reply
#5

I do?
Reply
#6

Bump, does anybody know how i can resolve this problem?
Reply
#7

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if(vehicleid == 416)
	{
 		if(GetPlayerSkin(playerid) == 274 || GetPlayerSkin(playerid) == 275 || GetPlayerSkin(playerid) == 276)
 		{
    		SendClientMessage(playerid, -1," You just entered the ambulance!");
		}
		else
		{
 			TogglePlayerControllable(playerid, 0);
			SendClientMessage(playerid,0xFFFF00AA," You're not an EMS!");
			SetTimerEx("Unfreeze", 4000, false, "i", playerid);
    	}
	}
	return 1;
}

forward Unfreeze(playerid);
public Unfreeze(playerid)
{
	TogglePlayerControllable(playerid, 0);
}
Untested, but should work.

edit: I tried it and it didn't work. The whole function (OnPlayerEnterVehicle) didn't even get called, but it could be my script.
Reply
#8

Hey, doesn't seem to work. He still just get frozen, even if i don't add anything to my code, other than the GetPlayerSkin :/
Reply
#9

So even if you remove OnPlayerEnterVehicle, the player gets frozen? Then the problem is somewhere else in your script.

edit: paste your OnPlayerStateChange callback if you have it
Reply
#10

No, not if i delete OnPlayerEnterVehicle.

It's also running as a filterscript, and there are no others problems in my script. It's just wierd how whenever I use GetPlayerSkin it makes him freeze, if he got does not have the right skin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)