What is wronge with this code ? -
ShawnMiller1337 - 01.12.2010
Everytime I put this code in my script my pawno.exe crashes
Everytime I remove this code , it compiles fine...
What is wronge with this code anyone ? or atleast fix it please , Much appriciated
Код:
if(strcmp(cmd, "/getweed", true) == 0)
{
new dlevel = PlayerInfo[playerid][pDrugsSkill];
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pJob] == 4 && (IsPlayerInRangeOfPoint(playerid,10.0,1534.885986, -1451.428589, 16.386175))
{
if(dlevel >= 0 && dlevel <= 50) // Level 1
{
if(PlayerInfo[playerid][pPot] >= 6)
{
SendClientMessage(playerid, COLOR_GREY, "Already have enought pot");
return 1;
}
ShowDrugsMenu(playerid, 1);
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not a drug dealer");
return 1;
}
return 1;
}
Re: What is wronge with this code ? -
dice7 - 01.12.2010
You missed a bracket somewhere
Re: What is wronge with this code ? -
ShawnMiller1337 - 01.12.2010
Where would that be ?
Re: What is wronge with this code ? -
Biesmen - 01.12.2010
No, you have a bracket too much. Try this:
pawn Код:
if(strcmp(cmd, "/getweed", true) == 0)
{
new dlevel = PlayerInfo[playerid][pDrugsSkill];
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pJob] == 4 && (IsPlayerInRangeOfPoint(playerid,10.0,1534.885986, -1451.428589, 16.386175))
{
if(dlevel >= 0 && dlevel <= 50) // Level 1
{
if(PlayerInfo[playerid][pPot] >= 6)
{
SendClientMessage(playerid, COLOR_GREY, "Already have enought pot");
return 1;
}
ShowDrugsMenu(playerid, 1);
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not a drug dealer");
return 1;
}
or
pawn Код:
if(strcmp(cmd, "/getweed", true) == 0)
{
new dlevel = PlayerInfo[playerid][pDrugsSkill];
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pJob] == 4 && (IsPlayerInRangeOfPoint(playerid,10.0,1534.885986, -1451.428589, 16.386175))
{
if(dlevel >= 0 && dlevel <= 50) // Level 1
{
if(PlayerInfo[playerid][pPot] >= 6)
{
SendClientMessage(playerid, COLOR_GREY, "Already have enought pot");
return 1;
}
ShowDrugsMenu(playerid, 1);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not a drug dealer");
return 1;
}
Re: What is wronge with this code ? -
ShawnMiller1337 - 01.12.2010
C:\Documents and Settings\Owner\Desktop\03bCore\gamemodes\RGv58.pwn (16674) : error 028: invalid subscript (not an array or too many subscripts): "IsPlayerInRangeOfPoint"
C:\Documents and Settings\Owner\Desktop\03bCore\gamemodes\RGv58.pwn (16675) : error 001: expected token: "}", but found "if"
Re: What is wronge with this code ? -
dice7 - 01.12.2010
You deleted the wrong bracket
pawn Код:
if(strcmp(cmd, "/getweed", true) == 0)
{
new dlevel = PlayerInfo[playerid][pDrugsSkill];
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pJob] == 4 && (IsPlayerInRangeOfPoint(playerid,10.0,1534.885986, -1451.428589, 16.386175))
{
if(dlevel >= 0 && dlevel <= 50) // Level 1
{
if(PlayerInfo[playerid][pPot] >= 6)
{
SendClientMessage(playerid, COLOR_GREY, "Already have enought pot");
return 1;
}
ShowDrugsMenu(playerid, 1);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not a drug dealer");
return 1;
}
return 1;
}
Re: What is wronge with this code ? -
ShawnMiller1337 - 01.12.2010
Still getting same error codes...
Re: What is wronge with this code ? -
dice7 - 01.12.2010
The command I posted is perfectly fine. You messed up your brackets somewhere else.
Re: What is wronge with this code ? -
ShawnMiller1337 - 01.12.2010
With your command it does not even compile , Just repeats the same process of pawno.exe has stopped working..
Re: What is wronge with this code ? -
Scenario - 01.12.2010
You don't need to "return 1" after every freaking line of code!
pawn Код:
if(strcmp(cmd, "/getweed", true) == 0)
{
new dlevel = PlayerInfo[playerid][pDrugsSkill];
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pJob] == 4 && IsPlayerInRangeOfPoint(playerid,10.0,1534.885986, -1451.428589, 16.386175))
{
if(dlevel >= 0 && dlevel <= 50) // Level 1
{
if(PlayerInfo[playerid][pPot] >= 6)
{
SendClientMessage(playerid, COLOR_GREY, "Already have enought pot");
}
ShowDrugsMenu(playerid, 1);
}
}
else SendClientMessage(playerid, COLOR_GREY, "You are not a drug dealer");
return 1;
}