SA-MP Forums Archive
how can i put 2 dcmd commands in 1 GM? - 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: how can i put 2 dcmd commands in 1 GM? (/showthread.php?tid=92439)



how can i put 2 dcmd commands in 1 GM? - Bcklup - 20.08.2009

Hello, i have made 2 dcmd commands /xkill and /money, they both work but they can't be put together at the same time,error occurs how to put them both in 1 GM? is it about return 0; or return 1;?


Re: how can i put 2 dcmd commands in 1 GM? - HuRRiCaNe - 20.08.2009

under onplayercommandtext*

dcmd(command,number of letters of the command,cmdtext);
dcmd(othercommand,number of letters of the command , cmdtext);
return 0;
}
--

you can put all the dcmds you want


Re: how can i put 2 dcmd commands in 1 GM? - Bcklup - 20.08.2009

that almost helped me but

Code:
C:\Documents and Settings\Administrator\Desktop\SOT\GTA SA Stuff\sampserv\gamemodes\PKDM.pwn(73) : error 017: undefined symbol "cmdtext"
C:\Documents and Settings\Administrator\Desktop\SOT\GTA SA Stuff\sampserv\gamemodes\PKDM.pwn(73) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\SOT\GTA SA Stuff\sampserv\gamemodes\PKDM.pwn(73) : warning 215: expression has no effect
C:\Documents and Settings\Administrator\Desktop\SOT\GTA SA Stuff\sampserv\gamemodes\PKDM.pwn(73) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Administrator\Desktop\SOT\GTA SA Stuff\sampserv\gamemodes\PKDM.pwn(73) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
this error happens (^), BTW, here is the script
Code:
public OnGameModeInit()
{
dcmd(xkill, 5, cmdtext);
dcmd(money, 5, cmdtext);
return 0;
}
dcmd_xkill(playerid, params[])
{
new	id;
if (sscanf(params, "u", id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/xkill <playerid>\"");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
else
{
SetPlayerHealth(id, 0.0);
SendClientMessage(id, 0x00FF00AA, "You have been killed :o");
SendClientMessage(playerid, 0x00FF00AA, "Player killed");
}
dcmd_money(playerid, params[])
{
new money;
if (sscanf(params, "d", money))SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/money <ammount>\"");
else
{
GivePlayerMoney(playerid, money);
SendClientMessage(playerid, 0x00FF00AA, "[SUCESS]: Money Added");
}
return 1;
}
It would help either by telling me how to solve this or Give me a example GM which has 2-3 dcmd commands in it


Re: how can i put 2 dcmd commands in 1 GM? - Bcklup - 20.08.2009

Sorry for the double post
BTW, the script above is just a cut from the OnGameModeInit Callback if that info should help


Re: how can i put 2 dcmd commands in 1 GM? - kevin974 - 20.08.2009

Omg, You use it on OnPlayerCommandText not OnGameModeInt


Re: how can i put 2 dcmd commands in 1 GM? - Yuryfury - 20.08.2009

Not under OnGameModeInIt, under OnPlayerCommandText.

EDIT: aww Kevin beat me to it :P


Re: how can i put 2 dcmd commands in 1 GM? - Bcklup - 21.08.2009

Big_Smok3 said i should put it in OnGameModeInit
and i think i will need a simple script that has 2-5 dcmd commands in it


Re: how can i put 2 dcmd commands in 1 GM? - Bcklup - 21.08.2009

ok solved my problem i think


Re: how can i put 2 dcmd commands in 1 GM? - Yuryfury - 21.08.2009

Quote:
Originally Posted by Bcklup
Big_Smok3 said i should put it in OnGameModeInit
and i think i will need a simple script that has 2-5 dcmd commands in it
Well he is wrong https://sampwiki.blast.hk/wiki/Fast_Commands

If you need any help (since you "think" that it is fixed) just ask


Re: how can i put 2 dcmd commands in 1 GM? - HuRRiCaNe - 21.08.2009

lol sorry i confused is onplayercommandtext sorry for causing problems.