Problem with my code -
ChristofferHoffmann - 24.12.2011
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;
}
Re: Problem with my code -
Thresholdold - 24.12.2011
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;
}
Re: Problem with my code -
ChristofferHoffmann - 24.12.2011
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
Re: Problem with my code -
-CaRRoT - 24.12.2011
You can Just use RemovePlayerFromVehicle ?
Re: Problem with my code -
ChristofferHoffmann - 24.12.2011
I do?
Re: Problem with my code -
ChristofferHoffmann - 24.12.2011
Bump, does anybody know how i can resolve this problem?
Re: Problem with my code -
spedico - 24.12.2011
Код:
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.
Re: Problem with my code -
ChristofferHoffmann - 25.12.2011
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 :/
Re: Problem with my code -
spedico - 25.12.2011
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
Re: Problem with my code -
ChristofferHoffmann - 25.12.2011
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.