PDA

View Full Version : invalid function or declaration - Problem


roncohen7
27/04/2016, 09:13 AM
C:\Users\Ron\Desktop\Insanity Gaming RP\gamemodes\/../gamemodes/includes/DSRP.pwn(42766) : warning 217: loose indentation
C:\Users\Ron\Desktop\Insanity Gaming RP\gamemodes\/../gamemodes/includes/DSRP.pwn(42769) : warning 217: loose indentation
C:\Users\Ron\Desktop\Insanity Gaming RP\gamemodes\/../gamemodes/includes/DSRP.pwn(42776) : warning 217: loose indentation
C:\Users\Ron\Desktop\Insanity Gaming RP\gamemodes\/../gamemodes/includes/DSRP.pwn(45128) : warning 209: function "cmd_accept" should return a value
C:\Users\Ron\Desktop\Insanity Gaming RP\gamemodes\/../gamemodes/includes/DSRP.pwn(45129) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.


}
else
{
PlayerInfo[RefillOffer[playerid]][pMechSkill] += 1;
PlayerInfo[RefillOffer[playerid]][pXP] += PlayerInfo[RefillOffer[playerid]][pLevel] * XP_RATE;
}

if(RefillPrice[playerid] >= 30000 && (PlayerInfo[playerid][pLevel] <= 3 || PlayerInfo[RefillOffer[playerid]][pLevel] <= 3)) {
format(szMessage, sizeof(szMessage), "%s (IP:%s) has refueled %s (IP:%s) $%d in this session.", GetPlayerNameEx(playerid), ip, GetPlayerNameEx(RefillOffer[playerid]), ipex, RefillPrice[playerid]);
//Log("logs/pay.log", szMessage);
ABroadCast(COLOR_YELLOW, szMessage, 2);
}

RefillOffer[playerid] = INVALID_PLAYER_ID;
RefillPrice[playerid] = 0;
return 1;
}
return 1;
}
return 1;
}
else {
SendClientMessageEx(playerid, COLOR_GREY, " You can't afford the refill!");
return 1;
}
}
else {
SendClientMessageEx(playerid, COLOR_GREY, " No-one offered you to refill your Car!");
return 1;
}
}
else { return 1; }
}

return 1;
}


This is a big code I can't copy everything here.
The error is from the last return 1;
I have also warnings on this code.

}

if(strcmp(params, "death", true) == 0) {
if(GetPVarInt(playerid, "Injured") == 1) {
for(new i; i < MAX_PLAYERS; i++) { // GetPlayerPool() or foreach is highly recommended!
if(IsAMedic(i))
return SendClientMessage(playerid, COLOR_GREY, "There are FD Members Online!, (/service ems)");
break;
}
}
SendClientMessageEx(playerid, COLOR_WHITE, "You gave up hope and fell unconscious, you were immediately sent to the hospital.");
KillEMSQueue(playerid);
ResetPlayerWeaponsEx(playerid);
SpawnPlayer(playerid);
}
else { SendClientMessageEx(playerid, COLOR_GREY, " You are not injured, you can't do this right now !"); }
}

Can someone help?

RedCounty
27/04/2016, 09:18 AM
Try this and let me know, please:

}
else
{
PlayerInfo[RefillOffer[playerid]][pMechSkill] += 1;
PlayerInfo[RefillOffer[playerid]][pXP] += PlayerInfo[RefillOffer[playerid]][pLevel] * XP_RATE;
}

if(RefillPrice[playerid] >= 30000 && (PlayerInfo[playerid][pLevel] <= 3 || PlayerInfo[RefillOffer[playerid]][pLevel] <= 3)) {
format(szMessage, sizeof(szMessage), "%s (IP:%s) has refueled %s (IP:%s) $%d in this session.", GetPlayerNameEx(playerid), ip, GetPlayerNameEx(RefillOffer[playerid]), ipex, RefillPrice[playerid]);
//Log("logs/pay.log", szMessage);
ABroadCast(COLOR_YELLOW, szMessage, 2);
}

RefillOffer[playerid] = INVALID_PLAYER_ID;
RefillPrice[playerid] = 0;
}
}
}
else {
SendClientMessageEx(playerid, COLOR_GREY, " You can't afford the refill!");
return 1;
}
}
else {
SendClientMessageEx(playerid, COLOR_GREY, " No-one offered you to refill your Car!");
return 1;
}
}
else { return 1; }
}

return 1;
}

You used "return 1;" in multiple open places, making the last one un-reachable.

Also, please can you state the warning(s) you are getting from the last part? Is it the loose indentation?

EDIT:

If it is loose indentation, here is an attempted fix:

if(strcmp(params, "death", true) == 0) {
if(GetPVarInt(playerid, "Injured") == 1) {
for(new i; i < MAX_PLAYERS; i++) { // GetPlayerPool() or foreach is highly recommended!
if(IsAMedic(i))
return SendClientMessage(playerid, COLOR_GREY, "There are FD Members Online!, (/service ems)");
break;
}
}
SendClientMessageEx(playerid, COLOR_WHITE, "You gave up hope and fell unconscious, you were immediately sent to the hospital.");
KillEMSQueue(playerid);
ResetPlayerWeaponsEx(playerid);
SpawnPlayer(playerid);
}
else { SendClientMessageEx(playerid, COLOR_GREY, " You are not injured, you can't do this right now !"); }
}

roncohen7
27/04/2016, 09:22 AM
Try this and let me know, please:

}
else
{
PlayerInfo[RefillOffer[playerid]][pMechSkill] += 1;
PlayerInfo[RefillOffer[playerid]][pXP] += PlayerInfo[RefillOffer[playerid]][pLevel] * XP_RATE;
}

if(RefillPrice[playerid] >= 30000 && (PlayerInfo[playerid][pLevel] <= 3 || PlayerInfo[RefillOffer[playerid]][pLevel] <= 3)) {
format(szMessage, sizeof(szMessage), "%s (IP:%s) has refueled %s (IP:%s) $%d in this session.", GetPlayerNameEx(playerid), ip, GetPlayerNameEx(RefillOffer[playerid]), ipex, RefillPrice[playerid]);
//Log("logs/pay.log", szMessage);
ABroadCast(COLOR_YELLOW, szMessage, 2);
}

RefillOffer[playerid] = INVALID_PLAYER_ID;
RefillPrice[playerid] = 0;
}
}
}
else {
SendClientMessageEx(playerid, COLOR_GREY, " You can't afford the refill!");
return 1;
}
}
else {
SendClientMessageEx(playerid, COLOR_GREY, " No-one offered you to refill your Car!");
return 1;
}
}
else { return 1; }
}

return 1;
}

You used "return 1;" in multiple open places, making the last one un-reachable.

Also, please can you state the warning(s) you are getting from the last part? Is it the loose indentation?

EDIT:

If it is loose indentation, here is an attempted fix:

if(strcmp(params, "death", true) == 0) {
if(GetPVarInt(playerid, "Injured") == 1) {
for(new i; i < MAX_PLAYERS; i++) { // GetPlayerPool() or foreach is highly recommended!
if(IsAMedic(i))
return SendClientMessage(playerid, COLOR_GREY, "There are FD Members Online!, (/service ems)");
break;
}
}
SendClientMessageEx(playerid, COLOR_WHITE, "You gave up hope and fell unconscious, you were immediately sent to the hospital.");
KillEMSQueue(playerid);
ResetPlayerWeaponsEx(playerid);
SpawnPlayer(playerid);
}
else { SendClientMessageEx(playerid, COLOR_GREY, " You are not injured, you can't do this right now !"); }
}

The warnings are on params, "death" the last code I posted at the first post.

roncohen7
27/04/2016, 09:29 AM
Try this and let me know, please:

}
else
{
PlayerInfo[RefillOffer[playerid]][pMechSkill] += 1;
PlayerInfo[RefillOffer[playerid]][pXP] += PlayerInfo[RefillOffer[playerid]][pLevel] * XP_RATE;
}

if(RefillPrice[playerid] >= 30000 && (PlayerInfo[playerid][pLevel] <= 3 || PlayerInfo[RefillOffer[playerid]][pLevel] <= 3)) {
format(szMessage, sizeof(szMessage), "%s (IP:%s) has refueled %s (IP:%s) $%d in this session.", GetPlayerNameEx(playerid), ip, GetPlayerNameEx(RefillOffer[playerid]), ipex, RefillPrice[playerid]);
//Log("logs/pay.log", szMessage);
ABroadCast(COLOR_YELLOW, szMessage, 2);
}

RefillOffer[playerid] = INVALID_PLAYER_ID;
RefillPrice[playerid] = 0;
}
}
}
else {
SendClientMessageEx(playerid, COLOR_GREY, " You can't afford the refill!");
return 1;
}
}
else {
SendClientMessageEx(playerid, COLOR_GREY, " No-one offered you to refill your Car!");
return 1;
}
}
else { return 1; }
}

return 1;
}

You used "return 1;" in multiple open places, making the last one un-reachable.

Also, please can you state the warning(s) you are getting from the last part? Is it the loose indentation?

EDIT:

If it is loose indentation, here is an attempted fix:

if(strcmp(params, "death", true) == 0) {
if(GetPVarInt(playerid, "Injured") == 1) {
for(new i; i < MAX_PLAYERS; i++) { // GetPlayerPool() or foreach is highly recommended!
if(IsAMedic(i))
return SendClientMessage(playerid, COLOR_GREY, "There are FD Members Online!, (/service ems)");
break;
}
}
SendClientMessageEx(playerid, COLOR_WHITE, "You gave up hope and fell unconscious, you were immediately sent to the hospital.");
KillEMSQueue(playerid);
ResetPlayerWeaponsEx(playerid);
SpawnPlayer(playerid);
}
else { SendClientMessageEx(playerid, COLOR_GREY, " You are not injured, you can't do this right now !"); }
}


C:\Users\Ron\Desktop\Insanity Gaming RP\gamemodes\/../gamemodes/includes/DSRP.pwn(42766) : warning 217: loose indentation
C:\Users\Ron\Desktop\Insanity Gaming RP\gamemodes\/../gamemodes/includes/DSRP.pwn(42769) : warning 217: loose indentation
C:\Users\Ron\Desktop\Insanity Gaming RP\gamemodes\/../gamemodes/includes/DSRP.pwn(42776) : warning 217: loose indentation
C:\Users\Ron\Desktop\Insanity Gaming RP\gamemodes\/../gamemodes/includes/DSRP.pwn(45125) : warning 209: function "cmd_accept" should return a value
C:\Users\Ron\Desktop\Insanity Gaming RP\gamemodes\/../gamemodes/includes/DSRP.pwn(45127) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.