warning 209: function "OnPlayerRequestClass" should return a value -
Vrondakis - 03.01.2012
Code:
public OnPlayerRequestClass(playerid, classid)
{
if(classid == 1){
if(PlayerNameIs(playerid, "Vrondakis")){
}else{
SendClientMessage(playerid,COLOR_RED,"You are not the mighty Vrondakis");}
return 0;} // OR 1?
SetupPlayerForClassSelection(playerid);
}
I'm making a RPG gamemode and trying to make custom classes. I'm using the inc "EasyNames" and keepn getting this error:
Code:
warning 209: function "OnPlayerRequestClass" should return a value
I don't like leaving warnings.
Thanks
Re: warning 209: function "OnPlayerRequestClass" should return a value -
Norck - 03.01.2012
Here you go:
pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
if(classid == 1){
if(PlayerNameIs(playerid, "Vrondakis")){
}else{
SendClientMessage(playerid,COLOR_RED,"You are not the mighty Vrondakis");}
return 0;} // OR 1?
SetupPlayerForClassSelection(playerid);
return 1;
}
Re: warning 209: function "OnPlayerRequestClass" should return a value -
Vrondakis - 03.01.2012
Oh ha

Dumb mistake.
Thanks
Re: warning 209: function "OnPlayerRequestClass" should return a value -
Vrondakis - 03.01.2012
pawn Code:
if(classid == 1){
if(PlayerNameIs(playerid, "Vrondakis")){
}else{
SendClientMessage(playerid,COLOR_RED,"You are not the mighty Vrondakis");}
return 0;}
//////This bit////
else
return 1;
SetupPlayerForClassSelection(playerid);
return 1;
}
//////^^^^//////
StreetWarz.pwn(9

: warning 225: unreachable code
Re: warning 209: function "OnPlayerRequestClass" should return a value -
Norck - 03.01.2012
I'm not sure what are you trying to do here, but anyway, check this out:
pawn Code:
if(classid == 1)
{
if(!PlayerNameIs(playerid, "Vrondakis"))
{
SendClientMessage(playerid,COLOR_RED,"You are not the mighty Vrondakis");
return 0;
}
}
SetupPlayerForClassSelection(playerid);
return 1;
}
//////^^^^//////
Re: warning 209: function "OnPlayerRequestClass" should return a value -
Vrondakis - 03.01.2012
I'm trying to make classes for only one player, for example;
if someone joins the game and trys to spawn with a class, and there name is not "Vrondakis" they get sent a message saying "You are not the mighty Vrondakis"
However, if there name is "Vrondakis" it lets them spawn.
Help please?
Re: warning 209: function "OnPlayerRequestClass" should return a value -
Norck - 03.01.2012
Okay, try this then:
pawn Code:
public OnPlayerRequestClass(playerid,classid)
{
if(classid == 1) // if class id is 1
{
if(!PlayerNameIs(playerid, "Vrondakis")) // and player's name is not Vrondakis
{
SendClientMessage(playerid,COLOR_RED,"You are not the mighty Vrondakis"); // will send a message
return 0; // and will not let them spawn
}
}
return 1;
}
Re: warning 209: function "OnPlayerRequestClass" should return a value -
Vrondakis - 03.01.2012
Thanks alot! Repped
Re: warning 209: function "OnPlayerRequestClass" should return a value -
Vrondakis - 03.01.2012
snip