Errors & Problem - 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: Errors & Problem (
/showthread.php?tid=178197)
Errors & Problem -
PixeledNinja - 21.09.2010
This command compiles without errors but it does give a few warnings. Although when I go in game and type /sethp it says Unknown command.
Код:
COMMAND::sethp(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] <= 1336)
{
new
toplayer, // Player that is recieving HP
newhp;
if (!sscanf(params, "ii", toplayer, newhp))
{
if (toplayer != INVALID_PLAYER_ID)
{
new
message[40];
SetPlayerHealth(toplayer, newhp);
format(message, sizeof(message), "Your HP has been set to $%d by an admin!", newhp);
SendClientMessage(toplayer, COLOR_SYSTEM, message);
}
else SendClientMessage(playerid, COLOR_SYSTEM, "Invalid ID");
}
else SendClientMessage(playerid, COLOR_SYSTEM, "[SYNTAX:] /sethp [id] [hp]");
}
else SendClientMessage(playerid, COLOR_SYSTEM, "You're not authorized to use this command.");
return 1;
}
Warnings:
Код:
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\pawno\include\streamer.inc(408) : warning 202: number of arguments does not match definition
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\gamemodes\RCRP.pwn(232) : warning 217: loose indentation
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\gamemodes\RCRP.pwn(248) : warning 213: tag mismatch
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\gamemodes\RCRP.pwn(511) : warning 204: symbol is assigned a value that is never used: "string"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Warnings.
Also if anyone could tell me how to fix my other warnings (408 and 511).
Re: Errors & Problem -
Backwardsman97 - 21.09.2010
Try this.
pawn Код:
COMMAND::sethp(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] <= 1336)
{
new
toplayer, // Player that is recieving HP
Float:newhp;
if (sscanf(params, "if", toplayer, newhp))
{
if (IsPlayerConnected(toplayer))
{
new
message[40];
SetPlayerHealth(toplayer, newhp);
format(message, sizeof(message), "Your HP has been set to $%f by an admin!", newhp);
SendClientMessage(toplayer, COLOR_SYSTEM, message);
}
else SendClientMessage(playerid, COLOR_SYSTEM, "Invalid ID");
}
else SendClientMessage(playerid, COLOR_SYSTEM, "[SYNTAX:] /sethp [id] [hp]");
}
else SendClientMessage(playerid, COLOR_SYSTEM, "You're not authorized to use this command.");
return 1;
}
And for the other warnings, we need to see some code.
Re: Errors & Problem -
PixeledNinja - 21.09.2010
Thanks, but when I try it, it still says Unknown command.
Anymore ideas? and I do have this just so you know.
Код:
#include <sscanf2>
#include <zcmd>
Re: Errors & Problem -
Toni - 21.09.2010
You did COMMAND:: sethp.
It requires only one colon. COMMAND: sethp.
I suggest you use CMD: sethp, as its much smaller, but has the same effect.