SA-MP Forums Archive
Problem With Script - 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: Problem With Script (/showthread.php?tid=94605)



Problem With Script - jeff223 - 30.08.2009

Well, what I want to do is have someone's wanted level recorded to FightClubWantedLevel when they enter the fight club (which is a DMing area) and when they leave, I want them to have their wanted level set back to what it was when they entered (because the killing in the club will cause their wanted level to go up). I am just giving you guys a little sample code so you can try and help me on what may be wrong. Thanks in advance guys!:

Код:
#include <a_samp>

forward WantedLevelFightClub();
forward WantedLevelFightClubExit();
// This is for the entrance to the Fight Club:
new FightClubWantedLevel[MAX_PLAYERS];

public WantedLevelFightClub()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
new FCWantedOne = GetPlayerWantedLevel(i);
{
FightClubWantedLevel[i] = FCWantedOne;
}
}
}
// And this is for the exit:
public WantedLevelFightClubExit()
{
for (new i = 0; i < MAX_PLAYERS; i++);
{
new FCWanted = FightClubWantedLevel[i];
{
SetPlayerWantedLevel(i, FCWanted);
}
}
}
And the errors:

Код:
C:\Users\Gamer\Desktop\Stuff\FlightClubWantedLevel.pwn(21) : error 036: empty statement
C:\Users\Gamer\Desktop\Stuff\FlightClubWantedLevel.pwn(23) : error 017: undefined symbol "i"
C:\Users\Gamer\Desktop\Stuff\FlightClubWantedLevel.pwn(25) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.



Re: Problem With Script - jeff223 - 30.08.2009

***EDIT*** someone did it


Re: Problem With Script - LuxurioN™ - 30.08.2009

what are the lines 21,23 and 25?

(I do not want your money)


Re: Problem With Script - Sayaron - 31.08.2009

Change "i" to "playerid", it may work


Re: Problem With Script - LuxurioN™ - 31.08.2009

Try:

pawn Код:
forward WantedLevelFightClub(playerid);
forward WantedLevelFightClubExit(playerid);

new FightClubWantedLevel[MAX_PLAYERS];

public WantedLevelFightClub(playerid)
{
new FCWantedOne = GetPlayerWantedLevel(playerid);
FightClubWantedLevel[playerid] = FCWantedOne;
}

public WantedLevelFightClubExit(playerid)
{
new FCWanted = FightClubWantedLevel[playerid];
SetPlayerWantedLevel(playerid, FCWanted);
}



Re: Problem With Script - Backwardsman97 - 31.08.2009

Quote:
Originally Posted by [LRP
Sayaron ]
Change "i" to "playerid", it may work
That wouldn't change a thing.

pawn Код:
#include <a_samp>

forward WantedLevelFightClub();
forward WantedLevelFightClubExit();
// This is for the entrance to the Fight Club:
new FightClubWantedLevel[MAX_PLAYERS];

public WantedLevelFightClub()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        FightClubWantedLevel[i] = GetPlayerWantedLevel(i);
    }
}

// And this is for the exit:
public WantedLevelFightClubExit()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        SetPlayerWantedLevel(i, FightClubWantedLevel[i]);
    }
}
There's a working, shorter version of your code. And the problem was in your second loop.

for (new i = 0; i < MAX_PLAYERS; i++); - That little guy at the end


Re: Problem With Script - LuxurioN™ - 31.08.2009

Really!

Change:

pawn Код:
for (new i = 0; i < MAX_PLAYERS; i++);
to

pawn Код:
for (new i = 0; i < MAX_PLAYERS; i++)
So small! 0o


Re: Problem With Script - jeff223 - 31.08.2009

-.- it worked Thank you so much! And I'm just clarifying this have someone's wanted level recorded to FightClubWantedLevel when they enter the fight club and when they leave, their wanted level will be set back to what it was when they entered?


Re: Problem With Script - Backwardsman97 - 31.08.2009

Yes.


Re: Problem With Script - noobasaurus - 31.08.2009

Quote:
Originally Posted by ► © The LuxurioN™
So small! 0o
that's what she said