WhaT? -.-
#1

pawn Код:
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
pawn Код:
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;
}
pawn Код:
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.");
Reply
#2

GetClosestPlayerToPlayer(playerid,ID) This defenition does not match with what you used:
Код:
public GetClosestPlayerToPlayer(playerid)
Try this maybe:
Код:
GetClosestPlayerToPlayer(ID)
Reply
#3

Код:
if(GetClosestPlayerToPlayer(playerid,ID) > RAPE_DISTANCE) return SendClientMessage(playerid, RED, "You are not close enough to eachother!");
Reply
#4

Quote:
Originally Posted by thimo
Посмотреть сообщение
GetClosestPlayerToPlayer(playerid,ID) This defenition does not match with what you used:
Код:
public GetClosestPlayerToPlayer(playerid)
Try this maybe:
Код:
GetClosestPlayerToPlayer(ID)
I still get the warning...
But this is also a fix thanks :P


Код:
warning 202: number of arguments does not match definition
pawn Код:
if(GetClosestPlayerToPlayer(playerid,ID) > RAPE_DISTANCE) return SendClientMessage(playerid, RED, "NO one close.");
Reply
#5

don't you see the difference
public GetClosestPlayerToPlayer(playerid) - how it should be
GetClosestPlayerToPlayer(playerid,ID)
Reply
#6

So what fixed the problem?
Reply
#7

sorry i wrote it bad .. it should be like this

Код:
if(GetClosestPlayerToPlayer(playerid) > RAPE_DISTANCE) return SendClientMessage(playerid, RED, "You are not close enough to eachother!");
Reply
#8

I dont think its like this... Doesnt make any sense to me dEcooR since he has a custom variable and then he just doesnt use it...
Reply
#9

How could your function be:

pawn Код:
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;
}
When you paste this into your command:


pawn Код:
if(GetClosestPlayerToPlayer(playerid,ID) > RAPE_DISTANCE) return SendClientMessage(playerid, RED, "NO one close.");
Look close at this:

Function: GetClosestPlayerToPlayer(playerid)
Command: GetClosestPlayerToPlayer(playerid,ID)

You should see your problem now I think.



EDIT: Too late before new posts..
Reply
#10

Quote:
Originally Posted by doreto
Посмотреть сообщение
don't you see the difference
public GetClosestPlayerToPlayer(playerid) - how it should be
GetClosestPlayerToPlayer(playerid,ID)
This worked thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)