forward PlayerToPoint (Float:radi, playerid, Float:x, Float:y, Float:z);
if (strcmp("/buyc4", cmdtext, true) == 0)
{
if(PlayerToPoint(1.0,playerid,-2044.0804,149.9467,28.8359))
{
if (C4BUY[playerid] == 1) return SendClientMessage(playerid, 0xFF0000AA, "You already have C4");
else
{
SendClientMessage(playerid, 0xFF0000AA, "You have purchased C4");
C4BUY[playerid] = 1;
}
}
return 1;
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}
Originally Posted by Blacklite
You can't just forward a function that doesn't exist.
Please learn how to code at least a little bit, before asking silly questions on here. Also, PlayerToPoint doesn't need to be a public function. |
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}
if (strcmp("/buyc4", cmdtext, true) == 0)
{
if(PlayerToPoint(1.0,playerid,-2044.0804,149.9467,28.8359))
{
if (C4BUY[playerid]) return SendClientMessage(playerid, 0xFF0000AA, "You already have C4");
else
{
C4BUY[playerid] = 1;
return SendClientMessage(playerid, 0xFF0000AA, "You have purchased C4");
}
}
SendClientMessage(playerid, 0xFF0000AA, "You are not at the right location to purchase C4");
return 1;
}
PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}