params ain't working.
#3

Quote:
Originally Posted by L.Hudson
Посмотреть сообщение
How about using this:

pawn Код:
dcmd_createtele(playerid, params[])
{
    if( PlayerInfo[playerid][pAdmin] >= 1339)
    {
        new id, string[128];
        new idx = GetFreeTeleSlot();
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, X11_GREEN, "USAGE: /createtele [name]");

        GetPlayerPos(playerid, TeleInfo[idx][tX], TeleInfo[idx][tY], TeleInfo[idx][tZ]);
        GetPlayerFacingAngle(playerid, TeleInfo[idx][tA]);
        TeleInfo[idx][tVW] = GetPlayerVirtualWorld(playerid);
        TeleInfo[idx][tInt] = GetPlayerInterior(playerid);
        strmid(TeleInfo[idx][tName], id, 0, strlen(id), 32);
        format(string, sizeof(string), "Teleport Created: [Name: %s | ID: %d | X: %.02f | Y: %.02f | Z: %.02f | A: %.02f | VW: %d | Int: %d]",
        TeleInfo[idx][tName], idx, TeleInfo[idx][tX], TeleInfo[idx][tY], TeleInfo[idx][tZ], TeleInfo[idx][tA], TeleInfo[idx][tVW], TeleInfo[idx][tInt]);
        SendClientMessage(playerid, X11_ORANGE, string);
        SaveTeleports();
    }
    else
    {
        SendClientMessage(playerid, X11_RED, "ERROR: You are not authorized to use this command.");
    }
    return 1;
}
What I did is to replace the param "s[32]" with "u" and changed new name[32] to new id; as the "u" param will get both the player's id and name.


The command is not for player. So why you use u.

Anyway,
Do you've updated sscanf?
Reply


Messages In This Thread
params ain't working. - by Black Axe - 30.04.2013, 08:22
Re: params ain't working. - by L.Hudson - 30.04.2013, 10:05
Re: params ain't working. - by JaKe Elite - 30.04.2013, 10:11
Re: params ain't working. - by L.Hudson - 30.04.2013, 10:15
Re: params ain't working. - by RVRP - 30.04.2013, 11:08

Forum Jump:


Users browsing this thread: 1 Guest(s)