I need help with my command! please :)
#1

HELP meh!
Im new to scripting and no good with making Teams.
So i made:

Quote:

#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" SWAT job made by Mike.");
print("--------------------------------------\n");
return 1;
}
#endif


public OnPlayerCommandText(playerid, cmdtext[])
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2492.28,2353.08,10.82))
{
if (strcmp("/SWAT", cmdtext, true, 10) ==0)
SendClientMessage(playerid, 0xFFFFFFFF,"Welcome to SWAT Duty, Aid the police and keep citizens safe!");
SendClientMessage(playerid, 0xFFFFFFFF,"To be a civilian hit F4 then do /kill, Remember no DMing!");
SetPlayerColor(playerid, 4294901930);
SetPlayerSkin(playerid,285);
SetPlayerArmour(playerid, 100);
GivePlayerWeapon(playerid, 31, 800); //M4
GivePlayerWeapon(playerid, 45, 1); //thermal goggles
GivePlayerWeapon(playerid, 34, 80); //sniper rifle
GivePlayerWeapon(playerid, 17, 80); //Teargas (thrown Version)
GivePlayerWeapon(playerid, 24, 80); //Deagle
return 1;
}
return 0;
}

And more of these type jobs,
But when ever i got to the location and do the command to get the skin, weps etc i can use any command to enable it like....
instead of just typing /SWAT to go on swat duty i could type /lol or /fuckthis commandisbroke and it would still work instead of just working for one specified command.
Can someone help me with whats going wrong, Thanks
Mike.
Reply
#2

Try removing:
Код:
 if(IsPlayerInRangeOfPoint(playerid, 7.0, 2492.28,2353.08,10.82))
The one in red: )) I thought its meant to be ), ??Im a newb so i dont really know but that might be it!
Reply
#3

You're missing a couple of braces in there, also, its best to do the distance check inside the command. I have re-done it for you, make sure you understand it all though.

You were very close, just a few little things out.

pawn Код:
#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
  print("\n--------------------------------------");
  print(" SWAT job made by Mike.");
  print("--------------------------------------\n");
  return 1;
}
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp("/SWAT", cmdtext, true)) //changed this a little bit, this way is a bit shorter and easier (imo)
  {
        if(IsPlayerInRangeOfPoint(playerid, 7.0, 2492.28,2353.08,10.82))
        {
            SendClientMessage(playerid, 0xFFFFFFFF,"Welcome to SWAT Duty, Aid the police and keep citizens safe!");
            SendClientMessage(playerid, 0xFFFFFFFF,"To be a civilian hit F4 then do /kill, Remember no DMing!");
            SetPlayerColor(playerid, 4294901930);
            SetPlayerSkin(playerid,285);
            SetPlayerArmour(playerid, 100);
            GivePlayerWeapon(playerid, 31, 800); //M4
            GivePlayerWeapon(playerid, 45, 1); //thermal goggles
            GivePlayerWeapon(playerid, 34, 80); //sniper rifle
            GivePlayerWeapon(playerid, 17, 80); //Teargas (thrown Version)
            GivePlayerWeapon(playerid, 24, 80); //Deagle
            return 1;
        }
        else
        {
            SendClientMessage(playerid,0xFF0000FF,"ERROR: You're not near the police station!"); //change this error message if you like. I don't know if it applies or not.
            return 1;
        }
    }
    return 0;
}
Reply
#4

Quote:
Originally Posted by Mike.
HELP meh!
Im new to scripting and no good with making Teams.
So i made:
...
Also as you are new to scripting i strongly suggest you to use zcmd+sccanf, that way
your code will be much more efficient and faster!
Reply
#5

Quote:
Originally Posted by DavidC
You're missing a couple of braces in there, also, its best to do the distance check inside the command. I have re-done it for you, make sure you understand it all though.

You were very close, just a few little things out.

pawn Код:
#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
 print("\n--------------------------------------");
 print(" SWAT job made by Mike.");
 print("--------------------------------------\n");
 return 1;
}
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
 if(!strcmp("/SWAT", cmdtext, true)) //changed this a little bit, this way is a bit shorter and easier (imo)
 {
        if(IsPlayerInRangeOfPoint(playerid, 7.0, 2492.28,2353.08,10.82))
        {
            SendClientMessage(playerid, 0xFFFFFFFF,"Welcome to SWAT Duty, Aid the police and keep citizens safe!");
            SendClientMessage(playerid, 0xFFFFFFFF,"To be a civilian hit F4 then do /kill, Remember no DMing!");
            SetPlayerColor(playerid, 4294901930);
            SetPlayerSkin(playerid,285);
            SetPlayerArmour(playerid, 100);
            GivePlayerWeapon(playerid, 31, 800); //M4
            GivePlayerWeapon(playerid, 45, 1); //thermal goggles
            GivePlayerWeapon(playerid, 34, 80); //sniper rifle
            GivePlayerWeapon(playerid, 17, 80); //Teargas (thrown Version)
            GivePlayerWeapon(playerid, 24, 80); //Deagle
            return 1;
        }
        else
        {
            SendClientMessage(playerid,0xFF0000FF,"ERROR: You're not near the police station!"); //change this error message if you like. I don't know if it applies or not.
            return 1;
        }
    }
    return 0;
}
Thanks this is good :P
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)