swat command help
#1

How would i make a command that gives a player swat skin and a mp5, m4, and fills his health up when he is near the lockers in the lspd?
If anyone can help me please it would be awesome !
thanks,
tommy
Reply
#2

Untested
pawn Код:
//top of script
new IsSwat[MAX_PLAYERS];
forward IsAtLockers();
//OnGameModeInIt()
SetTimer("IsAtLockers", 1000, 1);
//OnPlayerCommandText(playerid, cmdtext[])
if(strcmp(cmdtext, "/swat", true) == 0)
{
  SetPlayerSkin(playerid, 285);
  GivePlayerWeapon(playerid, 29, 600);
  GivePlayerWeapon(playerid, 31, 500);
  IsSwat[playerid] = 1;
  return 1;
}
//somewhere in script after main()
public IsAtLockers()
{
  for(new i = 0; i<GetMaxPlayers(); i++)
  {
   if(PlayerToPoint(3, playerid, X, Y, Z) && IsSwat[i] == 1) //replace X Y Z with the coordinates of the lockers
   {
     SetPlayerHealth(i, 100);
   }
  }
}
Reply
#3

Код:
C:\DOCUME~1\Owner\MYDOCU~1\MUSTAF~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\crp.pwn(1703) : warning 217: loose indentation
C:\DOCUME~1\Owner\MYDOCU~1\MUSTAF~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\crp.pwn(5660) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Owner\MYDOCU~1\MUSTAF~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\crp.pwn(5660) : error 004: function "IsAtLockers" is not implemented
C:\DOCUME~1\Owner\MYDOCU~1\MUSTAF~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\crp.pwn(5661) : warning 217: loose indentation
C:\DOCUME~1\Owner\MYDOCU~1\MUSTAF~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\crp.pwn(5664) : warning 213: tag mismatch
C:\DOCUME~1\Owner\MYDOCU~1\MUSTAF~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\crp.pwn(5664) : warning 213: tag mismatch
C:\DOCUME~1\Owner\MYDOCU~1\MUSTAF~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\crp.pwn(5664) : warning 213: tag mismatch
C:\DOCUME~1\Owner\MYDOCU~1\MUSTAF~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\crp.pwn(5670) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
thats what i got?
Reply
#4

To fix this: : error 004: function "IsAtLockers" is not implemented
pawn Код:
//At the top of script after #include <a_samp>
forward IsAtLockers();
After that, compile and paste lines 5660 - 5670.
Reply
#5

Okay, looking at what you asked for, I believe Swift_ Got a bit confused.

pawn Код:
//top of script
new IsSwat[MAX_PLAYERS];
forward IsAtLockers(playerid);
//OnGameModeInIt()
SetTimer("IsAtLockers", 1000, 1);
//OnPlayerCommandText(playerid, cmdtext[])
if(strcmp(cmdtext, "/swat", true) == 0)
{
    if(IsAtLockers(playerid))
    {
        SetPlayerSkin(playerid, 285);
        GivePlayerWeapon(playerid, 29, 600);
        GivePlayerWeapon(playerid, 31, 500);
        SetPlayerHealth(playerid, 100);
        IsSwat[playerid] = 1;
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOUR, " You are not at the lockers!");
        return 1;
    }
}
//somewhere in script after main()
public IsAtLockers(playerid)
{
 if(PlayerToPoint(3, playerid, X, Y, Z))
 {
        return 1;
 }
 return 0;
}
^ just a modified version of what swift_ did.

You could also just get rid of the whole callback and just add the PlayerToPoint to the command, but if you want to check if they are at the lockers in other commands this is easier.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)