[SERIOUS HELP SERIOUS ERRORS] undefined symbol "KillerName"
#1

Script...
Code:
public OnPlayerDeath(playerid, killerid, reason)
{
	if(killerid != INVALID_PLAYER_ID)
 		{
 		if(PlayerKills[playerid] >= 5 && PlayerKills[playerid] <= 14)
			{
        new string[256];
        new PlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        format(string, sizeof(string), "[Spree]%s has ended %s's killing spree! His reward is $750!", KillerName, PlayerName);
        SendClientMessageToAll(COLOR_GREEN, string);
        
        GivePlayerMoney(killerid, 750);
			}
    if(PlayerKills[playerid] >= 15 && PlayerKills[playerid] <= 44)
    	{
     		new string[256];
        new PlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        format(string, sizeof(string), "[Spree]%s has ended %s's killing spree! His reward is $1500!", KillerName, PlayerName);
        SendClientMessageToAll(COLOR_GREEN, string);

        GivePlayerMoney(killerid, 1500);
     	}
     if(PlayerKills[playerid] >= 45)
			{
	      new string[256];
        new PlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        format(string, sizeof(string), "[Spree]%s has ended %s's killing spree! His reward is $2500!", KillerName, PlayerName);
        SendClientMessageToAll(COLOR_GREEN, string);

        GivePlayerMoney(killerid, 2500);
			}
if(PlayerKills[killerid] == 5)
 		{
      new string[256];
      new KillerName[MAX_PLAYER_NAME];
      GetPlayerName(killerid, KillerName, sizeof(KillerName));
      format(string, sizeof(string), "[Spree]%s is now on a killing spree!", KillerName);
  		SendClientMessageToAll(COLOR_GREEN, string);

			GivePlayerMoney(killerid, 750);
  	}
   if(PlayerKills[killerid] == 15)
   	{
      new string[256];
      new KillerName[MAX_PLAYER_NAME];
      GetPlayerName(killerid, KillerName, sizeof(KillerName));
      format(string, sizeof(string), "[Spree]%s has been awarded a Minigun! Stop him before he does anymore damage!", KillerName);
  		SendClientMessageToAll(COLOR_GREEN, string);
  		
			GivePlayerWeapon(killerid, 38, 3000);
			GivePlayerMoney(killerid, 1500);
		}
 if(PlayerKills[killerid] == 45)
  	{
      new string[256];
      new KillerName[MAX_PLAYER_NAME];
      GetPlayerName(killerid, KillerName, sizeof(KillerName));
      format(string, sizeof(string), "[Spree]%s has 45 kills! Shame on the rest of you!", KillerName);
  		SendClientMessageToAll(COLOR_GREEN, string);

			GivePlayerWeapon(killerid, 38, 3000);
			GivePlayerMoney(killerid, 2500);
	 	}
  }

		PlayerKills[killerid]++;
		PlayerKills[playerid] = 0;
    return 1;
}
Code:
C:\DOCUME~1\USER\Desktop\server\GAMEMO~1\Death.pwn(300) : error 017: undefined symbol "KillerName"
C:\DOCUME~1\USER\Desktop\server\GAMEMO~1\Death.pwn(310) : error 017: undefined symbol "KillerName"
C:\DOCUME~1\USER\Desktop\server\GAMEMO~1\Death.pwn(320) : error 017: undefined symbol "KillerName"
I have no idea what these errors mean!


Plz help me with these errors I new to scripting so I dont know what to do...

Edit: Now only 3 errors, plz help!!!


Reply
#2

KK, i have shortened it down to 3 errors now!
Reply
#3

Plz tell me what these errors mean or how i can fix them.... plz....
Reply
#4

Well, lets have a closer look at your problem.

The error says:
Code:
undefined symbol: KillerName
So, now lets have a look. You are using KillerName quite alot, without having it declared nor assigned to anything. What does declare mean? Well, Pawn is a type-less language so, when declaring a variable its either a cell or a group of cells. Cells? What the heck are cells?
Think of a cell like a small box where you can place either a number or ONE character inside.

Now, declaring a variable which can hold a number would look like:
pawn Code:
new variable;
There we are!
but what would be needed so that we can make the variable hold "Hello"? Well, 5 cells! Each cell can hold one character, thats right.
So, lets declare it then!
pawn Code:
new hello[5] = "Hello";
Now, that would be the same as:
pawn Code:
new hello[5];
hello[0] = &#39;H';
hello[1] = &#39;e';
hello[2] = &#39;l';
hello[3] = &#39;l';
hello[4] = &#39;o';
Now, when looking at your problem, you have NEVER declared KillerName! Nor did you tell the script what KillerName is :O!

Well,

I am guessing that KillerName is the name of the person who killed the guy eh? If I am right then first of all we need a variable to store the name:
pawn Code:
new KillerName[MAX_PLAYER_NAME];
Alright, we got that! Now, we need a function to get the players name.. hmm.. I am sure there was something like that, wasn't there?

Yes there was! GetPlayerName

Alright, lets use it!
Hmm, the function itself says "killerid" in the parameters. Seems like thats the ID of the killer.
Lets parse it in the function!
pawn Code:
GetPlayerName(killerid, KillerName, sizeof(KillerName));

Alright, we got the name, declared and formatted onto the variable, now we can use it!
Reply
#5

Lol, thnx for ur help and all that but still same 3 errors
Reply
#6

Then you didn't think enough. Learning by doing was my motto when I started programming. Show some more enthiuasm and try it as much as you can until you figure out how it works. I give you another small hint and then you got to promise me to try it yourself a bit more. The hint is:

Have a look at
pawn Code:
PlayerName
Then read what I said again, I am sure you will figure it out
Reply
#7

'Something like '------------>HELP PLZ FAST NOW HELP!!!!!!!!!!!<----------' is not very descriptive and very annoying.'
'You can bump topics when the last reply is at least 12 hours old.'
Reply
#8

It would suck if this thread had to be deleted, because then you wouldn't get your serious help...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)