17.09.2015, 16:49
Hello guys, i have problem with following piece of code. I have a police job in my gamemode and cop can arrest players with a command, that's fine, but i decided to make it with a Left Alt key, but that doesn't work. Here is the code.. i hope you can help me :/ (when i press l.alt near wanted player as a cop, nothing happens. compiler also doesn't show any errors or warnings)
EDIT: i found out that it works only if player has ID 0
EDIT: i found out that it works only if player has ID 0
PHP код:
if (HOLDING(KEY_WALK))
{
if(PlayerInfo[playerid][Team] == 6) //If is player a cop
{
for(new i=1; i < MAX_PLAYERS; i++)
{
if(GetDistanceBetweenPlayers(playerid, i) <= 5)
{
if(!(IsPlayerInAnyVehicle(playerid)))
{
if(GetPlayerWantedLevel(playerid) == 1)
{
if(GetPlayerWantedLevel(i) >= 1)
{
new vehicleid = GetPlayerVehicleID(playerid);
format(szString, sizeof(szString), ""c"Policista "w"%s"c" zatkl hrбče "w"%s"c" s wanted levelem "w"%d"c".", pName(playerid), pName(i), GetPlayerWantedLevel(i));
SendClientMessageToAll(COLOR_BLUE, szString);
SetPlayerInterior(i, 6);
SetPlayerPos(i, 264.3156,77.4590,1001.0391);
GivePlayerMoney(playerid,2100);
GameTextForPlayer(playerid,"~y~Odmena: ~w~$2100",4000,6);
PlayerInfo[playerid][PolicistaZK] += 1;
PlayerInfo[playerid][XP] += 20;
SendClientMessage(playerid, COLOR_XP, "Zнskali jste 20 XP!");
PlayerPlaySound(playerid, 5201, 0.0,0.0,0.0);
PlayerPlaySound(i, 1083, 0.0,0.0,0.0);
GameTextForPlayer(i, "Zatcen", 2500, 5);
PlayerInfo[i][JailTime] = GetPlayerWantedLevel(i)*30;
SetPlayerHealth(i, 100.0);
SetPlayerArmour(i, 0.0);
SetPlayerWantedLevel(i, 0);
PlayerInfo[i][Zatcen] += 1;
ResetPlayerWeapons(i);
VTimer[i] = SetTimerEx("Vezeni", 1000, false, "i", i);
}
}
}
}
}
}