20.12.2014, 11:35
Hello can some1 tell my or give some sample script how to make example move object on key pressed like i have seen in alot of servers like if u want to start car engine u need tu press y or something
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if (PRESSED(KEY_ANALOG_LEFT )) { if(IsPlayerInRangeOfPoint(playerid, 7.0,1588, -1637.9004, 15))//policija garazas { MoveDynamicObject(gate1,1580, -1637.9004, 15,2.5); SendClientMessage(playerid, 0xFFFFFFFF, "Durys atidarytos!"); return 1; } else if(IsPlayerInRangeOfPoint(playerid, 7.0,1549.62, -1628.0699, 16))//policija ivaziavimas { MoveDynamicObject(gate2,1549.62,-1637.1030,16,2.5); SendClientMessage(playerid, 0xFFFFFFFF, "Durys atidarytos!"); return 1; } } return 1; }
new Used[MAX_PLAYERS];
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_ANALOG_LEFT ))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0,1588, -1637.9004, 15))//policija garazas
{
if(Used[playerid] == 0)
{
MoveDynamicObject(gate1,1580, -1637.9004, 15,2.5);
SendClientMessage(playerid, 0xFFFFFFFF, "Durys atidarytos!");
}
if(Used[playerid] == 1)
{
MoveDynamicObject(gate2,1549.62,-1637.1030,16,2.5);
SendClientMessage(playerid, 0xFFFFFFFF, "Durys atidarytos!");
}
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid, 7.0,1549.62, -1628.0699, 16))//policija ivaziavimas
{
MoveDynamicObject(gate2,1549.62,-1637.1030,16,2.5);
SendClientMessage(playerid, 0xFFFFFFFF, "Durys atidarytos!");
return 1;
}
}
return 1;
}
add
pawn Код:
pawn Код:
|
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if (PRESSED(KEY_ANALOG_LEFT )) { if(IsPlayerInRangeOfPoint(playerid, 7.0,1588, -1637.9004, 15))//policija garazas { if(Used[playerid] == 0) { MoveDynamicObject(gate1,1580, -1637.9004, 15,2.5); SendClientMessage(playerid, 0xFFFFFFFF, "Durys atidarytos!"); Used[playerid] = 1; return 1; } if(Used[playerid] == 1) { MoveDynamicObject(gate1,1588, -1637.9004, 15,2.5); SendClientMessage(playerid, 0xFFFFFFFF, "Durys uzdarytos!"); Used[playerid] = 0; return 1; } } else if(IsPlayerInRangeOfPoint(playerid, 7.0,1549.62, -1628.0699, 16))//policija ivaziavimas { MoveDynamicObject(gate2,1549.62,-1637.1030,16,2.5); SendClientMessage(playerid, 0xFFFFFFFF, "Durys atidarytos!"); return 1; } } return 1; }