[Fixed]Dm Scripting Errors!!!!
#1

Hey!!! I get these errors when i compile
Код:
C:\DOCUME~1\User\Desktop\server\GAMEMO~1\DEATHM~1.PWN(211) : error 017: undefined symbol "playerid"
C:\DOCUME~1\User\Desktop\server\GAMEMO~1\DEATHM~1.PWN(211) : error 001: expected token: ")", but found ";"
C:\DOCUME~1\User\Desktop\server\GAMEMO~1\DEATHM~1.PWN(211) : error 036: empty statement
C:\DOCUME~1\User\Desktop\server\GAMEMO~1\DEATHM~1.PWN(211) : fatal error 107: too many error messages on one line
Here is the script:
Код:
forward KillingSpree();

public KillingSpree()
{
	if(GetPlayerScore(playerid) == 3; //this is line 211 where the errors are
	{
 		new PlayerName[MAX_PLAYER_NAME],
		string[128];
		GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
		format(string, sizeof(string), "[Spree] %s is now on a killing spree!", PlayerName);
		SendClientMessageToAll(COLOR_GREEN, string);
		return 1;
	}
}
Im trying to make a script where if u get more than 3 kills, u go on a killing spree, if u get more than 10 kills, u get a minigun and if u get more than 20 kills u unlock /godcar and some cool vehicles!
Reply
#2

You could just put the code under OnPlayerDeath, and it would be fine, but you could also make it work the current way you've coded it, like so.

pawn Код:
forward KillingSpree(playerid); // Change the public one too
_________________________________________________

Now simply add this to OnPlayerDeath and it will call when someone dies . You should also add checking to make sure it's a valid death and a valid killer.

pawn Код:
KillingSpree(killerid);
Note: You're also missing a closing bracket from if(GetPlayerScore(playerid) == 3) and there's no need for the ; at the end of it either.
Reply
#3

pawn Код:
forward KillingSpree();

public KillingSpree()
{
    if(GetPlayerScore(playerid) == 3) // the ; should be a )
    {
        new PlayerName[MAX_PLAYER_NAME],
        string[128];
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        format(string, sizeof(string), "[Spree] %s is now on a killing spree!", PlayerName);
        SendClientMessageToAll(COLOR_GREEN, string);
        return 1;
    }
}
Reply
#4

Quote:
Originally Posted by Marcel
pawn Код:
forward KillingSpree();

public KillingSpree()
{
    if(GetPlayerScore(playerid) == 3) // the ; should be a )
    {
        new PlayerName[MAX_PLAYER_NAME],
        string[128];
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        format(string, sizeof(string), "[Spree] %s is now on a killing spree!", PlayerName);
        SendClientMessageToAll(COLOR_GREEN, string);
        return 1;
    }
}
Thnx u guys it worked! But now i get a warning! I hope u can help me fix it!!!:
Код:
C:\DOCUME~1\User\Desktop\server\GAMEMO~1\DEATHM~1.PWN(220) : warning 209: function "KillingSpree" should return a value
Reply
#5

Quote:
Originally Posted by Tigerbeast11
Quote:
Originally Posted by Marcel
pawn Код:
forward KillingSpree();

public KillingSpree()
{
    if(GetPlayerScore(playerid) == 3) // the ; should be a )
    {
        new PlayerName[MAX_PLAYER_NAME],
        string[128];
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        format(string, sizeof(string), "[Spree] %s is now on a killing spree!", PlayerName);
        SendClientMessageToAll(COLOR_GREEN, string);
        return 1;
    }
}
Thnx u guys it worked! But now i get a warning! I hope u can help me fix it!!!:
Код:
C:\DOCUME~1\User\Desktop\server\GAMEMO~1\DEATHM~1.PWN(220) : warning 209: function "KillingSpree" should return a value
Woohooo! I fixed it!! No errors!!! I just need to test the script!!! Anyways, thnx you guys, couldnt have done it without u!!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)