Problem with explode
#1

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.
Reply
#2

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)