Little Help ???
#1

Hi there
i have this command and i want that players can use this command only once in 2 minutes.

Can help ?

if(strcmp(cmdtext, "/naudoti", true)==0)
{
if(playerDB[playerid][narkotikai]<1)
{
SendClientMessage(playerid, COLOR, "* Neturite narkotiku");
return 1;
}

ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1 ,1,1,1);
playerDB[playerid][narkotikai]-=1;
SetPlayerHealth(playerid,100);
SendClientMessage(playerid,COLOR,"* Naudojate narkotikus");
SetPlayerScore(playerid,GetPlayerScore(playerid)-5);
return 1;
}
Reply
#2

pawn Код:
//At the top
new narkotikai[MAX_PLAYERS] = 0;
//
  if(strcmp(cmdtext, "/naudoti", true)==0)
  {
    if(playerDB[playerid][narkotikai]<1)
   {
     SendClientMessage(playerid, COLOR, "* Neturite narkotiku");
     return 1;
   }
   else if(narkotikai[playerid] == 0)
   {
    ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1);
    playerDB[playerid][narkotikai]-=1;
    SetPlayerHealth(playerid,100);
    SendClientMessage(playerid,COLOR,"* Naudojate narkotikus");
    SetPlayerScore(playerid,GetPlayerScore(playerid)-5);
    SetTimerEx("2min",120000,0,"d",playerid);
    narkotikai[playerid] = 1;
   }
   else if(narkotikai[playerid] == 1
   {
    SendClientMessage(playerid,COLOR,"* Palaukite 2min");
   }
    return 1;
  }

forward 2min(playerid);
public 2min(playerid)
{
   narkotikai[playerid] = 0;
}
Reply
#3

pawn Код:
//virsuj
new cmdUsed[MAX_PLAYERS];

if(strcmp(...)==0)
{
if(cmdUsed[MAX_PLAYERS] == -1) return SendClientMessage(/*can't use now, wait 2 minutes*/);
//ce darai komanda
cmdUsed[MAX_PLAYERS] = -1;
SetTimerEx("cmdUse", 120000, 0, "i", playerid);
}

forward cmdUse(i)
cmdUse(i)
{
cmdUsed[i] = 0;
}
matau vis dar mokaisi ;]

this should help [edit], too...
Reply
#4

Quote:
Originally Posted by Izanagi
pawn Код:
//virsuj
new cmdUsed[MAX_PLAYERS];

if(strcmp(...)==0)
{
if(cmdUsed[MAX_PLAYERS] == -1) return SendClientMessage(/*can't use now, wait 2 minutes*/);
//ce darai komanda
cmdUsed[MAX_PLAYERS] = -1;
SetTimerEx("cmdUse", 120000, 0, "i", playerid);
}

forward cmdUse(i)
cmdUse(i)
{
cmdUsed[i] = 0;
}
matau vis dar mokaisi ;]

this should help
Hehe.. I'm first
Reply
#5

Quote:
Originally Posted by Justas [SiJ
]
Quote:
Originally Posted by Izanagi
pawn Код:
//virsuj
new cmdUsed[MAX_PLAYERS];

if(strcmp(...)==0)
{
if(cmdUsed[MAX_PLAYERS] == -1) return SendClientMessage(/*can't use now, wait 2 minutes*/);
//ce darai komanda
cmdUsed[MAX_PLAYERS] = -1;
SetTimerEx("cmdUse", 120000, 0, "i", playerid);
}

forward cmdUse(i)
cmdUse(i)
{
cmdUsed[i] = 0;
}
matau vis dar mokaisi ;]

this should help
Hehe.. I'm first
well but the code i've given could be used not onlyfor his script, since it's easier to modify mine, but anyway.. ;]
Reply
#6

ilgai nescriptinau

stanginei visa laika
nepriejau prie script
Reply
#7

Its a kind request to post in English, so that everyone can understand this.. and will not make a new post for the same ..

Thank You
-Abhinav
Reply
#8

Quote:
Originally Posted by ۞●•λвнiиаv•●۞
Its a kind request to post in English, so that everyone can understand this.. and will not make a new post for the same ..

Thank You
-Abhinav
He said "Thanks for help guys"
Reply
#9

Thanks for translating
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)