SA-MP Forums Archive
Switch this code? - 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: Switch this code? (/showthread.php?tid=123044)



Switch this code? - Sal_Kings - 24.01.2010

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(takeoff, 7, cmdtext);
	return 0;
}
dcmd_takeoff(playerid, params[])
{
Код:
	switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
	{
		case 592, 577, 511, 512, 593, 520, 553, 476, 519, 460, 513:
		{
			new msg[128], name[24];
			GetPlayerName(playerid, name, sizeof (name));
			format(msg,sizeof(msg), "%s taking off", name);
			SendClientMessageToAll(0xEEEE00FF, msg);
		}
		default: SendClientMessage(playerid,0xEEEE00FF, "You are not in a plane, you cannot take off");
	}
}
Can you guys switch this code to strcmp? Because I'm getting 2 errors.
Код:
\Documents and Settings\salim\My Documents\PAWN\gamemodes\APH.pwn(157) : error 017: undefined symbol "dcmd"
E:\Documents and Settings\salim\My Documents\PAWN\gamemodes\APH.pwn(543) : warning 203: symbol is never used: "dcmd_takeoff"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: Switch this code? - Torran - 24.01.2010

1. Have you defined dcmd
2. Make sure you put it like this

pawn Код:
dcmd_takeoff(playerid, params[])
{
return 1;
}



Re: Switch this code? - mansonh - 24.01.2010

This is the code i just gave you a second ago with the instruction to include the dcmd from samp wiki, why make another post?
http://forum.sa-mp.com/index.php?top...6560#msg886560
https://sampwiki.blast.hk/wiki/Dcmd#Define_line
aka:
Код:
#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
and as toran said you need to include return 1;


Re: Switch this code? - Sal_Kings - 24.01.2010



I defied it already.


Re: Switch this code? - mansonh - 24.01.2010

if you defined it you wouldn't get this:
error 017: undefined symbol "dcmd"


Re: Switch this code? - Sal_Kings - 24.01.2010

I put the define to the tippy top. Now there is a new error.
Код:
E:\Documents and Settings\salim\My Documents\PAWN\gamemodes\APH.pwn(542) : warning 203: symbol is never used: "dcmd_takeoff"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
This is the line
Код:
dcmd_takeoff(playerid, params[])



Re: Switch this code? - mansonh - 24.01.2010

Thats just a warning you can ignore, but if you want that go away you can use #pragma unused params




Re: Switch this code? - mansonh - 24.01.2010

Oh wait thats code i put for someone elses question, i see.
Still you can always post in the same topic


Re: Switch this code? - Sal_Kings - 24.01.2010


Ok.
It's working but it sends the message "username is taking off" but it also sends you a "unkown command".


Re: Switch this code? - Torran - 24.01.2010

Did you return 1;