What;s wrong here? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: What;s wrong here? (
/showthread.php?tid=252446)
What;s wrong here? -
Cjgogo - 01.05.2011
I tried to make this heal command but I don't realise what'sworng:
pawn Код:
forward GetDistnaceBetweenPlayers(p1,p2);
public Float:GetDistanceBetweenPlayers(p1,p2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
{
return -1.00;
}
GetPlayerPos(p1,x1,y1,z1);
GetPlayerPos(p2,x2,y2,z2);
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
dcmd_heal(playerid,params[])
{
new gTeam1[MAX_PLAYERS];
if(gTeam1 == TEAM_MEDICS)
{
new pName[MAX_PLAYER_NAME];
new targetid, string[128];
GetPlayerHealth(targetid);
if(sscanf(params,"uz",targetid)) return SendClientMessage(playerid,RED,"Usage: /heal [playerid]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,RED,"Player is not connected or is yourself.");
if(GetDistanceBetweenPlayers(playerid,targetid) > 4) return SendClientMessage(playerid,RED,"Player is too far away");
if(GetDistanceBetweenPlayers(playerid,targetid) < 4)
{
format(string,sizeof(string),"%s has been healed by medic %d",pName);
SendClientMessageToAll(YELLOW,string);
SetPlayerHealth(targetid,100);
GivePlayerMoney(playerid,300);
GivePlayerMoney(targetid,-250);
}
}
return 1;
}
Код:
D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_win32\gamemodes\sfrpcrdm.pwn(908) : warning 235: public function lacks forward declaration (symbol "GetDistanceBetweenPlayers")
D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_win32\gamemodes\sfrpcrdm.pwn(926) : error 033: array must be indexed (variable "gTeam1")
D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_win32\gamemodes\sfrpcrdm.pwn(930) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Re: What;s wrong here? -
willsuckformoney - 01.05.2011
pawn Код:
stock Float:GetDistanceBetweenPlayers(p1,p2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
{
return -1.00;
}
GetPlayerPos(p1,x1,y1,z1);
GetPlayerPos(p2,x2,y2,z2);
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
pawn Код:
dcmd_heal(playerid,params[])
{
new gTeam1[MAX_PLAYERS];
if(gTeam1[playerid] == TEAM_MEDICS)
{
new pName[MAX_PLAYER_NAME];
new targetid, string[128];
GetPlayerHealth(targetid);
if(sscanf(params,"uz",targetid)) return SendClientMessage(playerid,RED,"Usage: /heal [playerid]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,RED,"Player is not connected or is yourself.");
if(GetDistanceBetweenPlayers(playerid,targetid) > 4) return SendClientMessage(playerid,RED,"Player is too far away");
if(GetDistanceBetweenPlayers(playerid,targetid) < 4)
{
format(string,sizeof(string),"%s has been healed by medic %d",pName);
SendClientMessageToAll(YELLOW,string);
SetPlayerHealth(targetid,100);
GivePlayerMoney(playerid,300);
GivePlayerMoney(targetid,-250);
}
}
return 1;
}
Try this
Re: What;s wrong here? -
Cjgogo - 01.05.2011
thanks betetr now,but still 1 warning numebr of arguments does not match the definiton GetPlayerHealth(targetid),help solve that more and thanks btw
Re: What;s wrong here? -
willsuckformoney - 01.05.2011
pawn Код:
new Float:Health;
GetPlayerHealth(playerid,Health);