31.07.2010, 22:07
Script problem
31.07.2010, 22:15
Try with this:
pawn Код:
dcmd_heal(playerid, params[])
{
new apple;
apple = SetPlayerHealth(player1, 100);
new player1 = strval(tmp);
new id;
if (sscanf(params, "u", id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/heal <playerid>\"");
else
{
apple(playerid);
}
return 1;
}
31.07.2010, 23:27
Sorry, try with this command:
pawn Код:
dcmd_heal(playerid,params[]) {
if(gTeam[playerid] == TEAM_MEDICS) {
new tmp[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(!strlen(tmp)) return SendClientMessage(playerid, red, "USAGE: /heal [playerid]");
new player1 = strval(tmp), string[128];
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
format(string, sizeof(string), "You has healed %s for $80.", pName(player1)); SendClientMessage(playerid,blue,string);
if(player1 != playerid) { format(string,sizeof(string),"%s has healed you for $80.", pName(playerid)); SendClientMessage(player1,blue,string); }
return SetPlayerHealth(player1, 100); GivePlayerMoney(playerid, 80);
} else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
} else return SendClientMessage(playerid,red,"Only medics can use this command!");
}
31.07.2010, 23:43
(
Последний раз редактировалось iggy1; 31.07.2010 в 23:53.
)
Here is a good method,
Not tested but should work.
Edit: Delete that apple fuction all it does is returns 2. Unless for some reason you need that, I cant see why though.
This
Might aswell be
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(heal, 4, cmdtext);
return 0;
}
dcmd_heal(playerid, params[])
{
new id Float:amount;
if (sscanf(params, "df", id,amount))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /heal <playerid> <amount>");
if(id != INVALID_PLAYER_ID)
{
if(amount <= 100.0 && amount >= 1)
{
SetPlayerHealth(id,amount);
return 1;
}
else return SendClientMessage(playerid, 0xFF0000AA, "Error: Invalid Amount");
}
else return SendClientMessage(playerid, 0xFF0000AA, "Error: Player not found");
}
Edit: Delete that apple fuction all it does is returns 2. Unless for some reason you need that, I cant see why though.
This
pawn Код:
stock apple(playerid)
{
return 1+1;
}
pawn Код:
stock apple(playerid)
{
return 2;
}
01.08.2010, 00:58
No guys it isn't the actual could I am looking at it, its the error I get when I try to call a function.
01.08.2010, 16:14
In that case i don't know whats wrong try putting your functions at bottom of script not at top.(mght not work but worth a try)
« Next Oldest | Next Newest »
Users browsing this thread: 3 Guest(s)