Problem with explode - 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)
+--- Thread: Problem with explode (
/showthread.php?tid=419683)
Problem with explode -
Eminem 2ka9 - 01.03.2013
I'm using ZCMD and sscanf etc.. this /expl code isn't working, why?
pawn Код:
CMD:explode(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
new string[128], id, Float:x, Float:y, Float:z, name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerPos(id, Float:x, Float:y, Float:z);
if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /expl [id/partofname]");
CreateExplosion(Float:x, Float:y, Float:z, 0, 30);
format(sendername, sizeof(sendername), "%s", Name(playerid));
format(giveplayer, sizeof(giveplayer), "%s", Name(targetid));
format(string, sizeof(string), "%s was exploded by %s.", giveplayer, sendername);
SendAdminMessage(C_GREY,string);
return 1;
}
return 1;
}
These are my errors:
pawn Код:
C:\Users\Guest\Desktop\Battlefield Server 1.8\gamemodes\battlefield.pwn(3033) : error 017: undefined symbol "sendername"
C:\Users\Guest\Desktop\Battlefield Server 1.8\gamemodes\battlefield.pwn(3033) : error 017: undefined symbol "sendername"
C:\Users\Guest\Desktop\Battlefield Server 1.8\gamemodes\battlefield.pwn(3033) : error 029: invalid expression, assumed zero
C:\Users\Guest\Desktop\Battlefield Server 1.8\gamemodes\battlefield.pwn(3033) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
Re: Problem with explode -
AndreT - 01.03.2013
The errors are VERY straightforward. Read them for a change.
Also, what does the Name() function return? The result from GetPlayerName? If so, then why ON EARTH do you use format to store it? Also I just gotta point out there's no logic in getting the player's name and coordinates before you even VALIDATE the command's parameters.