03.04.2011, 18:16
So i made a command to peoples rob matterials for creating gun.. But i add one timer to start the robbing and other timer to can use that command after 1min , But not working i can type /ukradimats 100 times and get 100000 materials please help me to fix this..
Here is cmd:
Here is KradeMats:
Here is cmd:
pawn Код:
if(strcmp("/ukradimats", cmdtext, true) == 0)
{
if(IsPlayerConnected(playerid))
if(PlayerToPoint(2.0, playerid, 1208.4185,-2649.9041,18.7244))
{
SetTimerEx("KradeMats", 30000, false, "d",playerid);
CommandCheck[playerid] = 1;
SetTimerEx("ResetCommandCheck", 120000, false, "i", playerid);
TogglePlayerControllable(playerid, 0);
return 1;
}
}
Here is KradeMats:
pawn Код:
public KradeMats(playerid)
{
if(IsPlayerConnected(playerid))
{
new string[257];
new RandomStart;
new sendername;
RandomStart = random(4);
switch(RandomStart)
{
case 0:
{
PlayerInfo[playerid][pMats] += 2000;
SendClientMessage(playerid,COLOR_YELLOW2,"Uspio si opljackati 2000 materijale!!");
format(string, sizeof(string), "%s Vadi vreca i sobira materijale", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
WantedPoints[playerid]+=4; SetPlayerCriminal(playerid,255, "Pljacka Materijale");
TogglePlayerControllable(playerid, 1);
}
case 1:
{
SendClientMessage(playerid,COLOR_RED,"Nisi uspio opljackati materijale,ulovila te Policija!!");
format(string, sizeof(string), "%s Ostava materijale.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
WantedPoints[playerid]=0; SetPlayerCriminal(playerid,255, "Pljacka Materijale");
TogglePlayerControllable(playerid, 1);
}
case 2:
{
PlayerInfo[playerid][pMats] += 1050;
SendClientMessage(playerid,COLOR_YELLOW2,"Uspio si opljackati 1050 materijale");
format(string, sizeof(string), "%s Vadi vreca i sobira materijale", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
WantedPoints[playerid]+=4; SetPlayerCriminal(playerid,255, "Pljacka Materijale");
TogglePlayerControllable(playerid, 1);
}
case 3:
{
PlayerInfo[playerid][pMats] -= 100;
SendClientMessage(playerid,COLOR_RED,"Nisi uspio opljackati materijale,ulovila te Policija!!");
format(string, sizeof(string), "%s Ostava materijale", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
WantedPoints[playerid]=0; SetPlayerCriminal(playerid,255, "Pljacka Materijale");
TogglePlayerControllable(playerid, 1);
}
}
}
return 1;
}