SA-MP Forums Archive
[Fixed]Dm Scripting Errors!!!! - 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: [Fixed]Dm Scripting Errors!!!! (/showthread.php?tid=101403)



[Fixed]Dm Scripting Errors!!!! - Tigerbeast11 - 10.10.2009

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!



Re: Dm Scripting Errors!!!! - JaTochNietDan - 10.10.2009

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.


Re: Dm Scripting Errors!!!! - Marcel - 10.10.2009

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;
    }
}



Re: Dm Scripting Errors!!!! - Tigerbeast11 - 10.10.2009

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



Re: Dm Scripting Errors!!!! - Tigerbeast11 - 10.10.2009

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!!!!