OnPlayerRequestSpawn bug
#1

Hey guys, I have a small problem,
Before I made the registration process, it was working smoothly, but now I can't view the classes, only spawn.
I mean, it doesn't pop up GameText and all.
PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    if(
GetPlayerTeam(playerid) != 0)
    {
        
TeamPlayers[GetPlayerTeam(playerid)]--;
        
SetPlayerTeam(playerid0);
        
SetPlayerColor(playerid0x6F6F6FFF);
    }
    if(
classid 3)
    {
        
SetPlayerPos(playerid213.6487421822.6784666.414062);
        
SetPlayerFacingAngle(playerid270.372558);
        
SetPlayerCameraLookAt(playerid213.6487421822.6784666.414062);
        
SetPlayerCameraPos(playerid213.648742 + (floatsin(-270.372558degrees)), 1822.678466 + (floatcos(-270.372558degrees)), 6.414062);
        
GameTextForPlayer(0"~b~MILITARY"10004);
    }
    if(
classid && classid 6)
    {
        
SetPlayerPos(playerid, -253.0854792594.71362370.695312);
        
SetPlayerFacingAngle(playerid269.577362);
        
SetPlayerCameraLookAt(playerid, -253.0854792594.71362370.695312);
        
SetPlayerCameraPos(playerid, -253.085479 + (floatsin(-269.577362degrees)), 2594.713623 + (floatcos(-269.577362degrees)), 70.695312);
        
GameTextForPlayer(0"~r~REBELS"10004);
    }
    if(
classid == 6)
    {
        
SetPlayerPos(playerid, -225.1588131395.948364172.414062);
        
SetPlayerFacingAngle(playerid0.229850);
        
SetPlayerCameraLookAt(playerid, -225.1588131395.948364172.414062);
        
SetPlayerCameraPos(playerid, -225.158813 + (floatsin(-0.229850degrees)), 1395.948364 + (floatcos(-0.229850degrees)), 172.414062);
        
GameTextForPlayer(0"~r~HITMEN AGENCY"10004);
    }
    if(
classid == 7)
    {
        
SetPlayerPos(playerid413.8956902535.12963819.148437);
        
SetPlayerFacingAngle(playerid179.603851);
        
SetPlayerCameraLookAt(playerid413.8956902535.12963819.148437);
        
SetPlayerCameraPos(playerid413.895690 + (floatsin(-179.603851degrees)), 2535.129638 + (floatcos(-179.603851degrees)), 19.148437);
        
GameTextForPlayer(0"~b~ALPHA TEAM"10004);
    }
    return 
1;

Last registration process: (two dialogs, one pass one email, after email registration is done)
PHP код:
case DIALOG_EMAIL:
        {
            if(!
response) return ShowPlayerDialog(playeridDIALOG_EMAILDIALOG_STYLE_INPUT"Registration""Please type in your e-mail in order to recover your account in the future.""Finish""Cancel");
            if(
strfind(inputtext"@") == -|| strfind(inputtext".") == -1) return ShowPlayerDialog(playeridDIALOG_EMAILDIALOG_STYLE_INPUT"Registration""Please enter a valid email address.""Finish""Cancel");
            new 
query[1028], daymonthyeardate[12], string[128];
            
getdate(yearmonthday);
            
format(datesizeof(date), "%02d/%02d/%d"daymonthyear);
            
mysql_format(mysqlquerysizeof(query), "INSERT INTO `Users` (`Username`, `IP`, `Registration`, `Password`, `EMail`) VALUES ('%e', '%e', '%e', '%e', '%e')"RPN(playerid), RPIP(playerid),
            
datePlayerInfo[playerid][pPassword], inputtext);
            new 
Cache:result mysql_query(mysqlquery);
            
PlayerInfo[playerid][pUserID] = cache_insert_id();
            
cache_delete(result);
            
format(stringsizeof(string), "%s has registered to [Military VS Rebels]"RPN(playerid));
            
SendClientMessageToAll(COLOR_GREYstring);
            
format(stringsizeof(string), "Welcome to [Military VS Rebels], your UserID is: %d"PlayerInfo[playerid][pUserID]);
            
SendClientMessage(playeridCOLOR_REDstring);
            
PlayerInfo[playerid][pLoggedIn] = 1;
            return 
1;
        } 
Thanks in advice.
Reply
#2

Bump
Reply
#3

I am not a 100% sure but you set the GameTextForPlayer to be shown only for id 0

Quote:

GameTextForPlayer(0, "~r~REBELS", 1000, 4);

set it to "playerid" instead of "0" and try again
Also read this > https://sampwiki.blast.hk/wiki/GameTextForPlayer
Reply
#4

Quote:
Originally Posted by KeithCooper
Посмотреть сообщение
I am not a 100% sure but you set the GameTextForPlayer to be shown only for id 0



set it to "playerid" instead of "0" and try again
Also read this > https://sampwiki.blast.hk/wiki/GameTextForPlayer
LOL What a mistake, I didn't even notice this, thanks.
Anyways, its not only the GameText, the whole if() function related to classid doesn't work
I simply press "Spawn" on blind.
Reply
#5

Anyone ?
Reply
#6

Use SetSpawnInfo Bro.
Reply
#7

Quote:
Originally Posted by Pearson
Посмотреть сообщение
Use SetSpawnInfo Bro.
I use it under OnPlayerRequsetSpawn, that is OnPlayerRequsetClass
I can't find any logical reason for not having the GameText and positions set
That's the public
PHP код:
public OnPlayerRequestSpawn(playerid)
{
    if(!
PlayerInfo[playerid][pLoggedIn])
    {
        
SendClientMessage(playeridCOLOR_RED"You have to login in order to spawn.");
        return 
0;
    }
    new 
skinid GetPlayerSkin(playerid);
    if(
skinid == 294)
    {
        if(!
PlayerInfo[playerid][pHitman])
        {
            
SendClientMessage(playeridCOLOR_RED"You are not in the Hitman Agency.");
            return 
0;
        }
        else
        {
               
SetSpawnInfo(playeridTEAM_REBELSskinid, -308.15651538.669675.5625131.0821000000);
            
SpawnPlayer(playerid);
            
TeamPlayers[TEAM_REBELS]++;
            
SetPlayerColor(playeridTEAM_COLOR_REBELS);
        }
    }
    if(
skinid == 285)
    {
        if(!
PlayerInfo[playerid][pAlpha])
        {
            
SendClientMessage(playeridCOLOR_RED"You are not in the Alpha Team.");
            return 
0;
        }
        else
        {
               
SetSpawnInfo(playeridTEAM_MILITARYskinid405.46372439.778116.50000.8792000000);
               
TeamPlayers[TEAM_MILITARY]++;
               
SetPlayerColor(playeridTEAM_COLOR_MILITARY);
            
SpawnPlayer(playerid);
        }
    }
    if(
skinid == 299 || skinid == 250 || skinid == 298)
    {
        if(
TeamPlayers[TEAM_REBELS] > TeamPlayers[TEAM_MILITARY])
        {
            
SendClientMessage(playeridCOLOR_RED"The Rebels team is full, please choose the Military team.");
            return 
0;
        }
        else
        {
            new 
spawn random(sizeof(TerrorSpawns));
            
SetSpawnInfo(playeridTEAM_REBELSskinidTerrorSpawns[spawn][0], TerrorSpawns[spawn][1], TerrorSpawns[spawn][2], TerrorSpawns[spawn][3], 000000);
            
TeamPlayers[TEAM_REBELS]++;
            
SetPlayerColor(playeridTEAM_COLOR_REBELS);
            
SpawnPlayer(playerid);
        }
    }
    if(
skinid == 287 || skinid == 179 || skinid == 191)
    {
        if(
TeamPlayers[TEAM_MILITARY] > TeamPlayers[TEAM_REBELS])
        {
            
SendClientMessage(playeridCOLOR_RED"The Military team is full, please choose the Rebels team.");
            return 
0;
        }
        else
        {
              new 
spawn random(sizeof(ArmySpawns));
            
SetSpawnInfo(playeridTEAM_REBELSskinidArmySpawns[spawn][0], ArmySpawns[spawn][1], ArmySpawns[spawn][2], ArmySpawns[spawn][3], 000000);
            
TeamPlayers[TEAM_MILITARY]++;
            
SetPlayerColor(playeridTEAM_COLOR_MILITARY);
            
SpawnPlayer(playerid);
        }
    }
    return 
0;

Reply
#8

Please someone ?
Reply
#9

Nevermind, bug solved.
I made a quick debug of the player classid and team, and I found out that instead of GetPlayerTeam == 0 I had to to == 255
Reply
#10

Whats wrong i dont understand
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)