Need help to fix some command. - 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: Need help to fix some command. (
/showthread.php?tid=240884)
Need help to fix some command. -
GBLTeam - 16.03.2011
So i have command like /ask peoples to ask questions and admins to read but i need something one time i created
it with timer btw it was not good
pawn Код:
if(strcmp(cmd,"/p",true)==0 || strcmp(cmd,"/pitaj",true)==0 || strcmp(cmd,"/ask",true)==0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Use: /pitaj [text]");
return 1;
}
format(string, sizeof(string), "Question from %s-a: %s", sendername, (result));
ABroadCast(COLOR_YELLOW2,string,1);
SendClientMessage(playerid, COLOR_YELLOW2, "Your question is sended to admins.");
}
return 1;
}
Re: Need help to fix some command. -
maramizo - 16.03.2011
Please use more details and better English.
Re: Need help to fix some command. -
GBLTeam - 17.03.2011
Quote:
Originally Posted by maramizo
Please use more details and better English.
|
So you dont understand
1. I create a command which is for questions Insertion (like on some servers /askq)
2. But peoples spaming so i want to add 1min waiting before again type /askq question.
3. One time i have tried with Settimerex but there was problem.
So really need this anyone to answer. Thanks!
Re: Need help to fix some command. -
Marricio - 17.03.2011
pawn Код:
new WaitforAsk[MAX_PLAYERS];
forward Wait(playerid);
public OnPlayerCommandText(...)
{
if(strcmp(cmd,"/p",true)==0 || strcmp(cmd,"/pitaj",true)==0 || strcmp(cmd,"/ask",true)==0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Use: /pitaj [text]");
return 1;
}
if(WaitForAsk[playerid] == 1)
{
SendClientMessage(playerid,color,"You must wait 60 seconds to ask another question !");
return 1;
}
format(string, sizeof(string), "Question from %s-a: %s", sendername, (result));
ABroadCast(COLOR_YELLOW2,string,1);
WaitForAsk[playerid] = 1;
SetTimerEx("Wait",60*1000,true,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW2, "Your question is sended to admins.");
}
return 1;
}
public Wait(playerid)
{
WaitForAsk[playerid] = 0;
SendClientMessage(playerid,COLOR,"Feel free to use /askq again!");
}
Re: Need help to fix some command. -
GBLTeam - 17.03.2011
Btw one problem when i type /pitaj question its typed 2 times why?
Re: Need help to fix some command. -
GBLTeam - 17.03.2011
anyone?