Simple question.. - 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: Simple question.. (
/showthread.php?tid=159369)
Simple question.. -
GaGlets(R) - 13.07.2010
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..
Re: Simple question.. -
Kar - 13.07.2010
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;
}
Re: Simple question.. -
GaGlets(R) - 13.07.2010
Ok thank you very much...
///-----------------------------
what about unused params? there is needed to define it? (your teleport command)
Re: Simple question.. -
Kar - 13.07.2010
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.