OnPlayerRequestSpawn problem
#1

So lately I've developed a CnR Points system.What this does for e.g if you have 1000 CnRP you are able to join classes that require 1000 CnRP or less.I wrote the code, compiles fine but even if I have the requested CnRP for the class I can't join it and btw the error message wont appear too.Does anyone have any ideas how to fix it?

PHP код:
public OnPlayerRequestSpawn(playerid)
{
    switch(
pInfo[playerid][Class])
    {
        case 
CLASS_FBI:
        {
            if(
pInfo[playerid][CnRP] > 10000)
            {
                
SendClientMessage(playerid, -1"{AA3333}[ERROR] {FFFFFF}You must have {FFFF00}10,000 CnR Points to join the FBI class");
                return 
1;
            }
        }
        case 
CLASS_CIA:
        {
            if(
pInfo[playerid][CnRP] > 15000)
            {
                
SendClientMessage(playerid, -1"{AA3333}[ERROR] {FFFFFF}You must have {FFFF00}15,000 CnR Points to join the CIA class");
                return 
1;
            }   
        }
        case 
CLASS_MILITARY:
        {
            if(
pInfo[playerid][CnRP] > 25000)
            {
                
SendClientMessage(playerid, -1"{AA3333}[ERROR] {FFFFFF}You must have {FFFF00}20,000 CnR Points to join the Military class");
                return 
1;
            }
        }
    }
    return 
1;

Reply
#2

Bump
Reply
#3

Use return 0; instead of return 1;
Returning 0 will prevent the player from spawning and will send the error message.
Reply
#4

Код:
public OnPlayerRequestSpawn(playerid)
{
    switch(pInfo[playerid][Class])
    {
        case CLASS_FBI:
        {
            if(pInfo[playerid][CnRP] > 10000)
            {
                SendClientMessage(playerid, -1, "{AA3333}[ERROR] {FFFFFF}You must have {FFFF00}10,000 CnR Points to join the FBI class");
                return 0;
            }
        }
        case CLASS_CIA:
        {
            if(pInfo[playerid][CnRP] > 15000)
            {
                SendClientMessage(playerid, -1, "{AA3333}[ERROR] {FFFFFF}You must have {FFFF00}15,000 CnR Points to join the CIA class");
                return 0;
            }   
        }
        case CLASS_MILITARY:
        {
            if(pInfo[playerid][CnRP] > 25000)
            {
                SendClientMessage(playerid, -1, "{AA3333}[ERROR] {FFFFFF}You must have {FFFF00}20,000 CnR Points to join the Military class");
                return 0;
            }
        }
    }
    return 1;
}
Just like this.
Reply
#5

Thanks, can't believe I didn't return 0;
Reply
#6

Ahaha good luck
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)