Make these commands to work faster.. -
SiJ - 17.07.2009
Hey,
Atm I only know how to make commands with dcmd.. And idk.. some commands take about 2-4 seconds to process..
Here are two of them:
pawn Код:
dcmd_goto(playerid,params[]) // This command teleports me to player
{
if (dUserINT(PlayerName(playerid)).("Adminlvl")>=2)
{
new id, Float:x,Float:y,Float:z;
if (sscanf(params, "u", id)) UsageMsg(playerid, "USAGE: /goto <PlayerID/PartOfName>");
else if (id == INVALID_PLAYER_ID) ErrorMsg(playerid, "Player not found");
else
{
GetPlayerPos(id,x,y,z);
new interior = GetPlayerInterior(id);
SetPlayerInterior(playerid,interior);
SetPlayerPos(playerid,x,y+2,z+1);
}
}
return 1;
}
dcmd_getplayer(playerid,params[]) //This command teleports player to me
{
if (dUserINT(PlayerName(playerid)).("Adminlvl")>=2)
{
new id, Float:x,Float:y,Float:z;
if (sscanf(params, "u", id)) UsageMsg(playerid, "USAGE: /getplayer <PlayerID/PartOfName>");
else if (id == INVALID_PLAYER_ID) ErrorMsg(playerid, "Player not found");
else
{
if (IsPlayerInAnyVehicle(id)) RemovePlayerFromVehicle(id);
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(id,x,y+2,z+1);
}
}
return 1;
}
So is it possible to make them to work faster?
Re: Make these commands to work faster.. -
Vince - 17.07.2009
What is
dUserInt supposed to do?
Re: Make these commands to work faster.. -
Anarkien - 17.07.2009
Quote:
Originally Posted by Vince
What is dUserInt supposed to do?
|
DUDB -
http://forum.sa-mp.com/index.php?topic=4798.0 .. if that's what you're asking for.
Re: Make these commands to work faster.. -
SiJ - 17.07.2009
Soooo.... Anybody wants to answer my question..?
Re: Make these commands to work faster.. -
Andom - 17.07.2009
My sugestion is to get a rid of dini, and use ffile.
Re: Make these commands to work faster.. -
SiJ - 17.07.2009
Quote:
Originally Posted by [NL
WackoX ]
My sugestion is to get a rid of dini, and use ffile.
|
Is it faster? Or u just think it's better? And there are no ffile in these forums... :S
Re: Make these commands to work faster.. -
Rac3r - 17.07.2009
When they login, save their login status. Then just check it to see if they are admin. This would save constantly checking the user file.
Код:
cmd_goto(playerid,params[]) // This command teleports me to player
{
if (Admin[Playerid]>2)
{
// code
}
return 1;
}
Re: Make these commands to work faster.. -
SiJ - 17.07.2009
Quote:
Originally Posted by [LSD
Rac3r ]
When they login, save their login status. Then just check it to see if they are admin. This would save constantly checking the user file.
Код:
cmd_goto(playerid,params[]) // This command teleports me to player
{
if (Admin[Playerid]>2)
{
// code
}
return 1;
}
|
OK, thanks.. I'll do that..
![Smiley](images/smilies/smile.png)
Any other optimization possibilities here?
Re: Make these commands to work faster.. -
Rac3r - 18.07.2009
Honestly, I wouldn't worry. The command looks right, any optimisation would be very small and probably wouldn't effect any performance issues.
Take this as an example :
http://pastebin.com/m2d39cc17
If I changed your command, for my command... On our server we wouldn't notice any speed difference. Type the command, SA-MP does the command.
SA-MP is very quick at processing code, worrying too much about a few extra lines of code is not worth it IMO.