Ensuring XP requirement before spawning
#1

Hello, i'm trying to make an XP requirement...



How to check if the player has enough XP or not?


if(pInfo[playerid][pXP] <= 9999)
return SendClientMessage(playerid, -1, "{FF0000}[ERROR]{FFFFFF} You do not have enough XP to join this class.");
else

//REST CODE


But idk where to put it under.. which callback..
Reply
#2

do you even understand what you want to do?
Reply
#3

I'm working on a CnR gamemode, I want to make a requirement for classes, a bar of XP, for like 10k, if they have 10k+ XP, they can join that CLASS(like ARMY), if not a msg will be shown "YOU DO NOT MEET THE XP REQUIREMENT"
Reply
#4

DAYUM BUMP, PLEASE HELP..
Reply
#5

Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid); 
    return 1;
}
Код:
SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0)
    {
        if(pInfo[playerid][pXP] <= 9999)
        return SendClientMessage(playerid, -1, "{FF0000}[ERROR]{FFFFFF} You do not have enough XP to join this class.");
    }
    else if(classid == 1)
    {
       if(pInfo[playerid][pXP] <= 0)
       return SendClientMessage(playerid, -1, "{FF0000}[MESSAGE]{FFFFFF} You joined this class.");
    }

}
Reply
#6

Not really working, i feel like it should be under OnPlayerRequestSpawn..

Any function which can prevent a player from spawning?
Reply
#7

Write downside onplayerrequestspawn
if(classid == something)
if(pInfo[playerid][pXP]<9999)
SendClientMessage(playerid, red, "you have joined army");
else
return 0;
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)