I have one little problem so pls help.
#6

pawn Код:
#include a_samp

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

dcmd_kill(playerid,params[])
{
new player2 = strval(params);
new params1[256], index;
params1 = strtok(params, index);
if(!strlen(params))
{
SendClientMessage(playerid,0xFF0000AA,"Usage: /kill [playerid]");
return 1;
}
if(!IsPlayerConnected(player2))
{
SendClientMessage(playerid,0xFFFFFFAA,"Error: Player is not connected");
return 1;
}
new playername[MAX_PLAYER_NAME], playername2[MAX_PLAYER_NAME], string[256];
GetPlayerName(player2, playername, sizeof(playername));
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string, sizeof(string), "%s has killed %s", playername2, playername);
SendClientMessageToAll(0xFF000AA, string);
SetPlayerHealth(player2, 0);
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(kill,4,cmdtext);
return 0;
}

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;
}
Compile that as a filterscript.
Reply


Messages In This Thread
I have one little problem so pls help. - by Frankox - 08.07.2009, 13:12
Re: I have one little problem so pls help. - by refshal - 08.07.2009, 13:21
Re: I have one little problem so pls help. - by Remba - 08.07.2009, 13:22
Re: I have one little problem so pls help. - by Frankox - 08.07.2009, 13:22
Re: I have one little problem so pls help. - by Frankox - 08.07.2009, 13:23
Re: I have one little problem so pls help. - by refshal - 08.07.2009, 13:26
Re: I have one little problem so pls help. - by Frankox - 08.07.2009, 13:39
Re: I have one little problem so pls help. - by refshal - 08.07.2009, 13:44
Re: I have one little problem so pls help. - by -Sneaky- - 08.07.2009, 14:10
Re: I have one little problem so pls help. - by Frankox - 08.07.2009, 15:45

Forum Jump:


Users browsing this thread: 3 Guest(s)