Some cmds
#10

sorry, I add strtok code and after it this cmd code and it is not working:
Strtok code:
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}

new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}

and this /report code

if(strcmp(cmdtext, "/report", true, 7)==0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid, 0xFF0000AA, "[ ! ] USAGE: /report [ID] [message]");
giveplayerid = strval(tmp);
if(!strlen(cmdtext[8])) return SendClientMessage(playerid, 0xFF0000AA, "Use /report [ID] [message]");
new str[128];
if((gettime()-LastReport[playerid]) < 30)
{
format(str, 128, "[ ! ] You have to wait %d seconds before you can send a new report!", (30-(gettime()-LastReport[playerid])));
SendClientMessage(playerid, 0xFF0000AA, str); return 1;
}
GetPlayerName(giveplayerid,giveplayer,sizeof(givep layer));
format(str, 128, "[REPORT] Sender ID: %d Victim ID: %d Victim: %s Message: %s", playerid,giveplayerid,giveplayer, cmdtext[8]);
for(new i; i<MAX_PLAYERS; i++){
if(IsPlayerConnected(i) && IsPlayerAdmin(i)){
SendClientMessage(i, 0x00FFFFAA, str);
}}
SendClientMessage(playerid, 0x00FF00AA, "Report sent to online admins!");
LastReport[playerid] = gettime();
return 1;

What do do? Can somebody explain me or give a web page?

Reply


Messages In This Thread
Some cmds - by Ironboy500 - 17.08.2009, 20:02
Re: Some cmds - by dice7 - 17.08.2009, 20:19
Re: Some cmds - by Ironboy500 - 17.08.2009, 20:23
Re: Some cmds - by MenaceX^ - 17.08.2009, 20:25
Re: Some cmds - by XtremeChio - 17.08.2009, 20:44
Re: Some cmds - by urkiefly101 - 17.08.2009, 21:10
Re: Some cmds - by ilikepie2221 - 17.08.2009, 23:49
Re: Some cmds - by coole210 - 18.08.2009, 00:13
Re: Some cmds - by XCultz - 18.08.2009, 00:45
Re: Some cmds - by Ironboy500 - 18.08.2009, 07:55

Forum Jump:


Users browsing this thread: 3 Guest(s)