Tazer Code [Help!]
#1

I've been working on a new tazer code. Basically instead of the standard, SDPistol pullout, and fire, it freezes the person nearest to you. But I'm having a bit of trouble. Much help would be appreciated.

Код:
CMD:tazer(playerid, params[])
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(IsACop(playerid) ||  PlayerInfo[playerid][pAdmin] == 6 || PlayerInfo[playerid][pAdmin] == 5)
			{
			    if(IsPlayerInAnyVehicle(playerid))
			    {
			        SendClientMessage(playerid, COLOR_GREY, "   Cannot use this in a vehicle !");
			        return 1;
			    }
			    new suspect = GetClosestPlayer(playerid);
			    if(IsPlayerConnected(suspect))
				{
				    if(PlayerCuffed[suspect] > 0)
				    {
				        SendClientMessage(playerid, COLOR_GREY, "   That player is already cuffed !");
				        return 1;
				    }
				    if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
					{
					    if(gTeam[suspect] == 2)
					    {
					        SendClientMessage(playerid, COLOR_GREY, "   Your tazer cannot penetrate this persons body armor.");
					        return 1;
					    }
					    if(IsPlayerInAnyVehicle(suspect))
					    {
					        SendClientMessage(playerid, COLOR_GREY, "   Suspect is in a vehicle, get him out first !");
					        return 1;
					    }
					    GetPlayerNameEx(suspect, giveplayerid, sizeof(giveplayerid));
						GetPlayerNameEx(playerid, giveplayerid, sizeof(playerid));
						format(string, sizeof(string), "* You were tazed by %s for 10 seconds.", giveplayerid);
						SendClientMessageEx(suspect, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* You tazed %s for 10 seconds.", giveplayerid);
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* %s shoots his taser at %s, and subdues him.", playerid , giveplayerid);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						GameTextForPlayerEx(suspect, "~r~Tazed", 2500, 3);
						TogglePlayerControllable(suspect, 0);
						PlayerCuffed[suspect] = 1;
						PlayerCuffedTime[suspect] = 10;
		            }
					else
					{
					    SendClientMessage(playerid, COLOR_GREY, "   There's no-one near you.");
					    return 1;
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "   You are not a cop !");
			}
		}//not connected
	    return 1;
	}
And Pawno tells me...

Код:
C:\Users\Administrator\Desktop\Movado 0.3D NGG\0.3D\gamemodes\vrrp.pwn(68057) : error 017: undefined symbol "giveplayerid"
C:\Users\Administrator\Desktop\Movado 0.3D NGG\0.3D\gamemodes\vrrp.pwn(68057) : error 017: undefined symbol "giveplayerid"
C:\Users\Administrator\Desktop\Movado 0.3D NGG\0.3D\gamemodes\vrrp.pwn(68057) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Desktop\Movado 0.3D NGG\0.3D\gamemodes\vrrp.pwn(68057) : fatal error 107: too many error messages on one line

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


4 Errors.
Thanks!
Reply
#2

pawn Код:
new suspect = GetClosestPlayer(playerid);
you're using suspect as your variable, change every "giveplayerid" to suspect.

edit: don't forget to give me a reputation point if that solves your problem, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)