if(GetClosestPlayerToPlayer(playerid,ID) > RAPE_DISTANCE) return SendClientMessage(playerid, RED, "You are not close enough to eachother!");
warning 202: number of arguments does not match definition
forward GetClosestPlayerToPlayer(playerid);
public GetClosestPlayerToPlayer(playerid)
{
new Float:dist = 1000.0;
new targetid = INVALID_PLAYER_ID;
new Float:x1,Float:y1,Float:z1;
new Float:x2,Float:y2,Float:z2;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(i == playerid) continue;
GetPlayerPos(i,x2,y2,z2);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
if(tmpdis < dist)
{
dist = tmpdis;
targetid = i;
}
}
return targetid;
}
dcmd_rape(playerid, params[])
{
new ID = strval(params);
if(!strlen(params))
{
SendClientMessage(playerid, RED, "USAGE: /rape [ID]");
}
else
{
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, RED, "That player is not connected!");
if(ID == playerid) return SendClientMessage(playerid, RED, "You cannot rape yourself!");
if(rapespam[playerid] == 0)
{
if(GetClosestPlayerToPlayer(playerid,ID) > RAPE_DISTANCE) return SendClientMessage(playerid, RED, "NO one close.");
public GetClosestPlayerToPlayer(playerid)
GetClosestPlayerToPlayer(ID)
if(GetClosestPlayerToPlayer(playerid,ID) > RAPE_DISTANCE) return SendClientMessage(playerid, RED, "You are not close enough to eachother!");
|
GetClosestPlayerToPlayer(playerid,ID) This defenition does not match with what you used:
Код:
public GetClosestPlayerToPlayer(playerid) Код:
GetClosestPlayerToPlayer(ID) |
warning 202: number of arguments does not match definition
if(GetClosestPlayerToPlayer(playerid,ID) > RAPE_DISTANCE) return SendClientMessage(playerid, RED, "NO one close.");
if(GetClosestPlayerToPlayer(playerid) > RAPE_DISTANCE) return SendClientMessage(playerid, RED, "You are not close enough to eachother!");
stock GetClosestPlayerToPlayer(playerid)
{
new Float:dist = 1000.0;
new targetid = INVALID_PLAYER_ID;
new Float:x1,Float:y1,Float:z1;
new Float:x2,Float:y2,Float:z2;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(i == playerid) continue;
GetPlayerPos(i,x2,y2,z2);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
if(tmpdis < dist)
{
dist = tmpdis;
targetid = i;
}
}
return targetid;
}
if(GetClosestPlayerToPlayer(playerid,ID) > RAPE_DISTANCE) return SendClientMessage(playerid, RED, "NO one close.");
|
don't you see the difference
public GetClosestPlayerToPlayer(playerid) - how it should be GetClosestPlayerToPlayer(playerid,ID) |