warning 209: function "OnPlayerRequestClass" should return a value
#1

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
Reply
#2

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;
}
Reply
#3

Oh ha Dumb mistake.
Thanks
Reply
#4

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
Reply
#5

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;
}
//////^^^^//////
Reply
#6

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?
Reply
#7

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;
}
Reply
#8

Thanks alot! Repped
Reply
#9

snip
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)