02.05.2013, 11:33
Can anyone help me with this command i want it to work without typing player id for example: /rape instead of /rape id and if possible convert it to zcmd please and thank you 

pawn Код:
dcmd_rape(playerid, params[])
{
new ID = strval(params);
if(!strlen(params))
{
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /rape [ID]");
}
else
{
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_ERROR, "That player is not connected!");
if(ID == playerid) return SendClientMessage(playerid, COLOR_ERROR, "You cannot rape yourself!");
if(rapespam[playerid] == 0)
{
if(GetDistanceBetweenPlayers(playerid,ID) > RAPE_DISTANCE) return SendClientMessage(playerid, COLOR_ERROR, "You are not close enough to eachother!");
new raperand = random(5);
if(raperand == 1 || raperand == 2)
{
format(string, sizeof(string), "%s (%i) noticed you trying to rape him", ReturnPlayerName(ID), ID);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) tried to rape you", ReturnPlayerName(playerid), playerid);
SendClientMessage(ID, COLOR_MSG, string);
}
else if(raperand == 3 || raperand == 5)
{
if(!chlamydia[ID])
{
chlamydia[ID] = 1;
new Float:health;
GetPlayerHealth(ID, health);
SetPlayerHealth(ID, health-5-random(10));
format(string, 256, "You raped and infected %s (%i) with Chlamydia", ReturnPlayerName(ID), ID);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) raped you and infected you with Chlamydia", ReturnPlayerName(playerid), playerid);
SendClientMessage(ID, COLOR_MSG, string);
}
else
{
new Float:health;
GetPlayerHealth(ID, health);
SetPlayerHealth(ID, health-5-random(15));
format(string, 256, "You raped %s (%i)", ReturnPlayerName(ID), ID);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) raped you", ReturnPlayerName(playerid), playerid);
SendClientMessage(ID, COLOR_MSG, string);
}
}
else if(raperand == 4)
{
if(!gonorrhea[ID])
{
gonorrhea[ID] = 1;
new Float:health;
GetPlayerHealth(ID, health);
SetPlayerHealth(ID, health-5-random(20));
format(string, 256, "You raped and infected %s (%i) with Gonorrhea", ReturnPlayerName(ID), ID);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) raped you and infected you with Gonorrhea", ReturnPlayerName(playerid), playerid);
SendClientMessage(ID, COLOR_MSG, string);
}
else
{
new Float:health;
GetPlayerHealth(ID, health);
SetPlayerHealth(ID, health-5-random(20));
format(string, 256, "You raped %s (%i)", ReturnPlayerName(ID), ID);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) raped you", ReturnPlayerName(playerid), playerid);
SendClientMessage(ID, COLOR_MSG, string);
}
}
rapespam[playerid] = 1;
SetTimerEx("rapespamt", ANTISPAM_RAPE*1000, false, "i", playerid);
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "Please wait before raping someone again!");
}
}
return 1;
}