SA-MP Forums Archive
Would i be able to do this? - 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: Would i be able to do this? (/showthread.php?tid=129609)



Would i be able to do this? - Torran - 22.02.2010

Would i be able to put all my commands into a include?
Then include it on my gamemode?


Re: Would i be able to do this? - aircombat - 22.02.2010

joining the question
________
Free Gift Card


Re: Would i be able to do this? - silvan - 22.02.2010

i guess you can put the stuff of the command in an include, but you need to put the " strcmp" thing or dcmd, or whatever you'll using in a fs or GM so commands will be only 4 lines .... like

if(strcmp(cmd, "/test", true) == 0)
{
IncludeFunction(param1,param2);
}


Re: Would i be able to do this? - acade - 22.02.2010

Yes,
On your .pwn at the top add:
Код:
#include "..\script\cmds.inc"
Then goto your server folder, add a script directory and then cmds.inc (This is where the commands are). Inside the .inc add OnPlayerCommandText e.t.c


Re: Would i be able to do this? - Joe Staff - 22.02.2010

If you use a callback in an include file, you can't use the same callback in the .pwn file.


Re: Would i be able to do this? - dice7 - 22.02.2010

In your gamemode
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  #include "..\cmds.txt"
  return 0;
}
And in cmds.txt

pawn Код:
if(strcmp(cmdtext, "/givecar", true) == 0)
{
  new Float:x, Float:y, Float:z;
  GetPlayerPos(playerid, x, y, z);
  PutPlayerInVehicle(playerid, CreateVehicle(411, x, y, z, 0.0, -1, -1, -1), 0);
  return 1;
}