23.09.2011, 06:53
Hi everyone.
Alright, my problem is:
I have the following code:
Everything is working fine, until I call either Rewardcash, RewardSP, or Rewardscore, which happens here:
I debugged my script and I noticed that the script stops either at the following lines:
I've been trying to fix this for a while now.
However, there is another weird problem.
If I do
Compiles fine.
But if I just do
I get the array index out of bounds error.
Any help would be highly appreciated.
Alright, my problem is:
I have the following code:
pawn Код:
enum Stuntz
{
Float:XS,
Float:YS,
Float:ZS,
Rewardcash,
RewardSP,
Rewardscore
}
new StuntPositions[3][Stuntz] =
{
{1712.2190,1448.4867,10.7327,1500,1,2},
{-2245.0986,321.5719,34.7447,1650,1,2},
{2507.3184,1793.3164,10.2443,1800,2,2}
};
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
new lawl = sizeof(StuntPositions);
PlaySound(playerid,1057);
PInfo[playerid][Stuntsdone]++;
static tempstr[128];
GivePlayerSP(playerid,StuntPositions[lawl][RewardSP]);
GivePlayerMoney(playerid,StuntPositions[lawl][Rewardcash]);
SetPlayerScore(playerid,GetPlayerScore(playerid)+StuntPositions[lawl][Rewardscore]);
UpdateRank(playerid);
PInfo[playerid][Stunting] = 0;
format(tempstr,128,"~g~~h~Stunt completed! ~y~~h~Earned: ~n~~r~~h~+%i Stunt Points ~n~+%i Score ~n~+$%i cash",StuntPositions[lawl][RewardSP],StuntPositions[lawl][Rewardscore],StuntPositions[lawl][Rewardcash]);
GameTextForPlayer(playerid,tempstr,6000,3);
CurrStunt[playerid][stuntid[playerid]] = 0;
DisablePlayerCheckpoint(playerid);
SetTimerEx("CanDoStunt",600000,false,"i",playerid);
return 1;
}
pawn Код:
GivePlayerSP(playerid,StuntPositions[lawl][RewardSP]);
GivePlayerMoney(playerid,StuntPositions[lawl][Rewardcash]);
SetPlayerScore(playerid,GetPlayerScore(playerid)+StuntPositions[lawl][Rewardscore]);
However, there is another weird problem.
If I do
pawn Код:
new lawl = sizeof(StuntPositions);
StuntPositions[lawl][Rewardcash]
But if I just do
pawn Код:
StuntPositions[sizeof(StuntPositions)][Rewardcash]
Any help would be highly appreciated.