SA-MP Forums Archive
Someone correct this for me - 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: Someone correct this for me (/showthread.php?tid=122637)



Someone correct this for me - JoeDaDude - 22.01.2010

pawn Код:
dcmd_tazer(playerid, params[])
{
    new id;
    new name[MAX_PLAYER_NAME], string[48];
   
    if (strlen(params))
    {
        id = strval(params);
        if (IsPlayerConnected(id))
        {
          if(GetPlayerTeam(playerid) == 1)
          {
                if(!IsPlayerInAnyVehicle(playerid))
                {
                  GetDistanceBetweenPlayers(playerid,id) <5)
                  {
                    if(GetPlayerTeam(id) == 1)
                    {
                        SendClientMessage(playerid, 0xFF0000AA, "You cannot tazer a fellow cop");
                        return 1;
                        }
                    if(IsPlayerInAnyVehicle(id))
                    {
          SendClientMessage(playerid, 0xFF0000AA, "You cannot tazer someone in a vehicle");
          return 1;
          }
                    ApplyAnimation(playerid,"CRACK","crckdeth2",4.1,1,1,1,1,1);
                    TogglePlayerControllable(id,0);
                GetPlayerName(playerid, name, sizeof(name));
                format(string, sizeof(string), "Police Officer %s has tazed you for 8 seconds.", name );
                SendClientMessage(id, 0xFFFF00AA, string);
                GetPlayerName(id, name1, sizeof(name1));
                format(string, sizeof(string), "You have tazed %s.", name1 );
                SendClientMessage(playerid, 0xFFFF00AA, string);
                    //format(string, sizeof(string), "* %s shoots with his Tazer at %s, and tazed him.", sendername ,giveplayer);
                    //ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    SetTimerEx("Tazer", 8000, 0, "i", playerid);
                }
                else
                {
                  SendClientMessage(playerid, 0xFF0000AA, "You cannot use this command while in a vehicle");
                }
            }
            else
            {
              SendClientMessage(playerid, 0xFF0000AA, "You are not a Cop");
            }
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Player not found");
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000AA, "Usage: /tazer [PlayerID/PartOfName]");
    }
    return 1;
}

forward Tazer(playerid);
public Tazer(playerid)
{
    TogglePlayerControllable(id, 1);
    SendClientMessage(id, COLOR_GREEN, "The effect of the tazer has worn off");
}
Код:
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(223) : error 004: function "GetDistanceBetweenPlayers" is not implemented
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(241) : error 033: array must be indexed (variable "dcmd_tazer")
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(610) : error 004: function "GetDistanceBetweenPlayers" is not implemented
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(610) : error 029: invalid expression, assumed zero
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(615) : error 079: inconsistent return types (array & non-array)
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(617) : warning 217: loose indentation
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(620) : error 079: inconsistent return types (array & non-array)
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(627) : error 017: undefined symbol "name1"
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(627) : error 017: undefined symbol "name1"
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(627) : error 029: invalid expression, assumed zero
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(627) : fatal error 107: too many error messages on one line

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


10 Errors.
EDIT: Ignore first 2 errors


Re: Someone correct this for me - Doppeyy - 22.01.2010

Lol you could at least ASK for help instead of :
Someone fix this for me.

[Doppeyy


Re: Someone correct this for me - Correlli - 22.01.2010

How about if you learn PAWN basics first? You're asking too much questions on the forum, you're 1st in "Top Topic Starters".
You can't expect others to fix the code for you all the time if you don't want to learn some basics yourself.


Re: Someone correct this for me - JoeDaDude - 22.01.2010

Quote:
Originally Posted by Don Correlli
How about if you learn PAWN basics first? You're asking too much questions on the forum, you're 1st in "Top Topic Starters".
You can't expect others to fix the code for you all the time if you don't want to learn some basics yourself.
Ive learnt as much as i can find,
But i cant fix these errors


Re: Someone correct this for me - kmzr - 22.01.2010

These are the simplest of errors to fix, use the search function and find out what causes the above errors.


Re: Someone correct this for me - J.W. - 22.01.2010

I don't get how someone can have over 800 posts in a forum which is mainly dedicated to scripting and be a total noob...


Re: Someone correct this for me - mamorunl - 22.01.2010

closing bracket, probably.


Re: Someone correct this for me - ihatetn931 - 22.01.2010

mostly when i get errors, I search the error code on the forum and get ideas from other peoples post to work out my problem, It comes in quite handy



Re: Someone correct this for me - JoeDaDude - 22.01.2010

Quote:
Originally Posted by kmzr
These are the simplest of errors to fix, use the search function and find out what causes the above errors.
I know what causes them, I know what they mean, Ive tried and ive failed in correcting them


Re: Someone correct this for me - Onyx09 - 22.01.2010

Try this
Код:
	if(strcmp(cmd, "/tazer", true) ==0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pAdmin] == 1337 || PlayerInfo[playerid][pAdmin] == 1338)
			{
			  if(IsPlayerInAnyVehicle(playerid))
			  {
			    SendClientMessage(playerid, COLOR_GREY, "  Cannot use this while being in the Car !");
			    return 1;
			  }
			  new suspect = GetClosestPlayer(playerid);
			  if(IsPlayerConnected(suspect))
				{
				  if(PlayerCuffed[suspect] > 0)
				  {
				    SendClientMessage(playerid, COLOR_GREY, "  Player already Cuffed !");
				    return 1;
				  }
				  if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
					{
					  if(gTeam[suspect] == 2)
					  {
					    SendClientMessage(playerid, COLOR_GREY, "  Cannot Tazer Cops / FBI / National Guard !");
					    return 1;
					  }
					  if(IsPlayerInAnyVehicle(suspect))
					  {
					    SendClientMessage(playerid, COLOR_GREY, "  Suspect is in a Car, get him out first !");
					    return 1;
					  }
					  GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "* You were Tazed by %s for 10 seconds.", sendername);
						SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* You Tazed %s for 10 seconds.", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* %s shoots with his Tazer at %s, and tazed him.", sendername ,giveplayer);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						GameTextForPlayer(suspect, "~r~Tazed", 2500, 3);
						TogglePlayerControllable(suspect, 0);
						PlayerCuffed[suspect] = 1;
						PlayerCuffedTime[suspect] = 10;
		      }
					else
					{
					  SendClientMessage(playerid, COLOR_GREY, "  No-one near you!");
					  return 1;
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "  You are not a Cop / FBI / National Guard !");
			}
		}//not connected
	  return 1;
	}
let me know if u get more errors