SA-MP Forums Archive
Problem with DCMD and user crashing - 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: Problem with DCMD and user crashing (/showthread.php?tid=85104)



Problem with DCMD and user crashing - BP13 - 05.07.2009

hi. I changed all of my teleports from strcmp to dcmd (faster) problem is that in other filter scripts strcmp's don't work anyone. but before i tried dcmd it was already in a admin FS and it never interfered with other stuff.

also- for some unknow reason people in my server crash alot. when someone crashes its not just 1 person it can be 3-15 people that will crash. sometimes someone will timeout when someone joins. Im kinda stunt on it. Its not a object/car problem.




Re: Problem with DCMD and user crashing - illay - 05.07.2009

You use '#pragma unused params'?

Copy here one Teleport Command.


Re: Problem with DCMD and user crashing - BP13 - 05.07.2009

Код:
#include <a_samp>

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(skroad, 6, cmdtext);
     return1;
}

dcmd_skroad(playerid, params[])
{
	#pragma unused params
	SetPlayerInterior(playerid, 0);
	ResetPlayerWeapons(playerid);
	SetPlayerPos(playerid,3893.8152, -1623.4252, 1442.5);
	GameTextForPlayer(playerid,"SKROAD",2500,3);
	SetCameraBehindPlayer(playerid);
	return 1;
}
thats how its setup


Re: Problem with DCMD and user crashing - refshal - 05.07.2009

I think that the "params" are the reason for the crash. I've noticed that this sometimes happens on my server too. Try using "cmdtext" instead of "params". Example:

pawn Код:
dcmd_skroad(playerid, cmdtext)
{
SetPlayerInterior(playerid, 0);
ResetPlayerWeapons(playerid);
SetPlayerPos(playerid,3893.8152, -1623.4252, 1442.5);
GameTextForPlayer(playerid,"SKROAD",2500,3);
SetCameraBehindPlayer(playerid);
return 1;
}
But if that doesn't work, then try this one:

pawn Код:
dcmd_skroad(playerid, cmdtext[])
{
SetPlayerInterior(playerid, 0);
ResetPlayerWeapons(playerid);
SetPlayerPos(playerid,3893.8152, -1623.4252, 1442.5);
GameTextForPlayer(playerid,"SKROAD",2500,3);
SetCameraBehindPlayer(playerid);
return 1;
}



Re: Problem with DCMD and user crashing - BP13 - 05.07.2009

well this is really weird cause since im using dcmd is 1 FS strcmp is disabled or something then it doesent work


Re: Problem with DCMD and user crashing - refshal - 05.07.2009

Did my code work? ~_~


Re: Problem with DCMD and user crashing - BP13 - 05.07.2009

ims till testing. something is is weird. commands that are wrong like if I type /jfdshfdskjsdfdj it wont say SERVER: Unknown Command Anymore.


Re: Problem with DCMD and user crashing - refshal - 05.07.2009

That's maybe cause of some bugged commands. That happened to me once before. When I typed something like "/asdasdsaassdasadasdaasdasdasd", then it said "[ERROR]: You must be in a vehicle". And that text was from my "/nos" command. XD


Re: Problem with DCMD and user crashing - BP13 - 05.07.2009

Quote:
Originally Posted by cοοp
That's maybe cause of some bugged commands. That happened to me once before. When I typed something like "/asdasdsaassdasadasdaasdasdasd", then it said "[ERROR]: You must be in a vehicle". And that text was from my "/nos" command. XD
Your Code - (both)

Код:
C:\DOCUME~1\Braeden\Desktop\SA\MYNEWE~1\FILTER~1\commands.pwn(666) : error 017: undefined symbol "params"
203: symbol is never used: "cmdtext"
C:\DOCUME~1\Braeden\Desktop\SA\MYNEWE~1\FILTER~1\commands.pwn(3146) : warning 203: symbol is never used: "cmdtext"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase ETC


2 Errors.



Re: Problem with DCMD and user crashing - refshal - 05.07.2009

Add this on the top of your script:

pawn Код:
#pragma unused cmdtext
OR do like this:

pawn Код:
dcmd_skroad(playerid, cmdtext)
{
#pragma unused cmdtext
SetPlayerInterior(playerid, 0);
ResetPlayerWeapons(playerid);
SetPlayerPos(playerid,3893.8152, -1623.4252, 1442.5);
GameTextForPlayer(playerid,"SKROAD",2500,3);
SetCameraBehindPlayer(playerid);
return 1;
}