24.08.2013, 08:38
I was building a mines system And The Problem is something is wrong with OnPlayerKeyStateChange No messages are shown nothing is working as if it isn't called
pawn Код:
CMD:mine(playerid,params[])
{
if(GetPVarInt(playerid,"class") != 4) return SendClientMessage(playerid,COLOR_RED,"You Have To Be A Heavy Trooper To Plant Mines");
if(Mines[playerid] == 0 && MinesOnHold[playerid] == 0) return SendClientMessage(playerid,COLOR_RED,"You Have No Mines Left");
if(Mines[playerid] == 0 && MinesOnHold[playerid] != 0)
{
Mines[playerid] = MinesOnHold[playerid];
MinesOnHold[playerid] = 0;
vMinesOnHold[playerid] = vMines[playerid];
vMines[playerid] = 0;
new str[24];
format(str,24,"You Have %i Mines Ready To Be Planted.",Mines[playerid]);
SendClientMessage(playerid,COLOR_GREEN,str);
}else if(Mines[playerid] != 0 && MinesOnHold[playerid] == 0)
{
MinesOnHold[playerid] = Mines[playerid];
Mines[playerid] = 0;
new str[24];
format(str,24,"You Have %i Mines On Hold.",MinesOnHold[playerid]);
SendClientMessage(playerid,COLOR_GREEN,str);
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_FIRE))
{
if(Mines[playerid] > 0)
{
if(GetPlayerWeapon(playerid) == 0)
{
SendClientMessage(playerid,COLOR_WHITE,"You Planted a MINE Wait 10 Seconds Till It Begins Working");
GetPlayerPos(playerid,minex[playerid][Mines[playerid]],miney[playerid][Mines[playerid]],minez[playerid][Mines[playerid]]);
Timer[mineo[playerid][Mines[playerid]]] = SetTimerEx("SetBomb",10000,0,"ii",playerid,Mines[playerid]);
Mines[playerid] = Mines[playerid] - 1;
}
}
}
return 1;
}