Simple question..
#1

I have never scripted with zcmd
so, it make things faster than strcmp/strtok or smthl ike that?

realy stupid question from my side.. i know that..
Reply
#2

yep its like strcmp takes 1-3 seconds to respond when u do /pc zcmd responds right away even if you lag very much

e.g zcmd

pawn Код:
CMD:heal(playerid, params[])
{
    if(gTeam[playerid] == TEAM_MEDIC)
        {
                new pid,  msg[256];
                if(sscanf(params, "u", pid)) return SendClientMessage(playerid, RED, "Usage: '/heal [playerid]'");
                if(IsPlayerConnected(pid))
                {
                    SetPlayerHealth(pid, 100);
                    format(msg, sizeof(msg), "%s has healed you.", ReturnName(playerid));
                    SendClientMessage(pid, YELLOW, msg);
                    format(msg, sizeof(msg), "You healed %s.", ReturnName(pid));
                    SendClientMessage(playerid, YELLOW, msg);
                }
                else
                {
                SendClientMessage(playerid, RED, "Player not connected Or Is YourSelf!");
                }
            }
        else
        {
        SendClientMessage(playerid, RED, "Only Medic's Can Use This Command!");
    }
    return 1;
}

[e.g teleport]

pawn Код:
CMD:adminbasels(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid) == 1)
    {
            SetVehiclePos(GetPlayerVehicleID(playerid),250.0003,-1821.5791,4.0133);
            new pvehicleid;
            SetVehicleZAngle(pvehicleid, 406);
    }
    else    SetPlayerPos(playerid,250.0003,-1821.5791,4.0133);
    return 1;
}
Reply
#3

Ok thank you very much...

///-----------------------------

what about unused params? there is needed to define it? (your teleport command)
Reply
#4

well you dont need params for teleport commands param would be used for sscanf

download the zcmd include and sscanf.

for sscanf where you see the "s" or "us" "uis" or whatever,

Код:
c - A character.
	d, i - An integer.
	h, x - A hex number (e.g. a colour).
	f - A float.
	s - A string.
	z - An optional string.
	pX - An additional delimiter where X is another character.
	'' - Encloses a litteral string to locate.
	u - User, takes a name, part of a name or an id and returns the id if they're connected.

	Now has IsNumeric integrated into the code.

	Added additional delimiters in the form of all whitespace and an
	optioanlly specified one in the format string.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)