Little Help ??? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Little Help ??? (
/showthread.php?tid=84836)
Little Help ??? -
[LNL]Remulis - 03.07.2009
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;
}
Re: Little Help ??? -
SiJ - 03.07.2009
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;
}
Re: Little Help ??? -
Ignas1337 - 03.07.2009
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...
Re: Little Help ??? -
SiJ - 03.07.2009
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
Re: Little Help ??? -
Ignas1337 - 03.07.2009
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.. ;]
Re: Little Help ??? -
[LNL]Remulis - 03.07.2009
ilgai nescriptinau
stanginei visa laika
nepriejau prie script
Re: Little Help ??? -
abhinavdabral - 03.07.2009
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
Re: Little Help ??? -
SiJ - 03.07.2009
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"
Re: Little Help ??? -
abhinavdabral - 03.07.2009
Thanks for translating