SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 28/12/2011, 07:02 AM   #1
Zunno
Big Clucker
 
Zunno's Avatar
 
Join Date: Dec 2009
Location: Germany
Posts: 49
Reputation: 7
Unhappy OnPlayerRequestClass help

Hello,
I have a problem with my Script.
When i press F4 on my Server, i came on the ClassSelection, but when i press the Spawn Button, i Spawn and came back to the ClassSelection.

My OnPlayerRequestClass Public:
pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
    print("OnPlayerRequestClass called...");
    SpawnPlayer(playerid);
    return 1;
}

I hope someone has a solution for my problem.

/Edit: I use SA-MP 0.3d R1, and this problem i had it in 0.3c too.

* Zunno
__________________
Sorry for my bad english..

German Special Forces Reallife
Zunno is offline   Reply With Quote
Old 28/12/2011, 07:07 AM   #2
Ironboy
High-roller
 
Ironboy's Avatar
 
Join Date: Nov 2010
Location: Isle of Man
Posts: 1,933
Reputation: 429
Default Re: OnPlayerRequestClass help

Show the code "OnPlayerSpawn"
__________________
Ironboy is offline   Reply With Quote
Old 28/12/2011, 07:16 AM   #3
Zunno
Big Clucker
 
Zunno's Avatar
 
Join Date: Dec 2009
Location: Germany
Posts: 49
Reputation: 7
Default Re: OnPlayerRequestClass help

OnPlayerSpawn:
pawn Code:
public OnPlayerSpawn(playerid)
{
    SetCameraBehindPlayer(playerid);
    SetPlayerTextLabel(playerid);
    if(GetPVarInt(playerid, "FreezeTime") == 0) { TogglePlayerControllable(playerid, 1); }
    InitLockDoors(playerid);
    STDPlayer[playerid] = 0;
    gTeam[playerid] = PlayerInfo[playerid][pTeam];
    if(gTeam[playerid] == 4) { gTeam[playerid] = 3; }
    //if(IsPlayerNPC(playerid)) { Eingeloggt[playerid] = 1; }
    if(GetPVarInt(playerid, "TBan") > 0) { DeletePVar(playerid, "TBan"); }
    if(Eingeloggt[playerid] == 0 && !IsPlayerNPC(playerid)) { SendClientMessage(playerid, COLOR_LIGHTRED, "** This server requires a login before spawning! **"); Kick(playerid); }
    //if(GetPVarInt(playerid, "AtClothes") == 1) { PlayerInfo[playerid][pModel] = GetPlayerSkin(playerid); DeletePVar(playerid, "AtClothes"); }
    if(gTeam[playerid] == 3)
    {
        if(PlayerInfo[playerid][pMember] > 0 || PlayerInfo[playerid][pLeader] > 0)
        {
            new model = GetPVarInt(playerid, "Char");
            if(PlayerInfo[playerid][pMember] == 1) { SetSpawnInfo(playerid, 2, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 2; gTeam[playerid] = 2; }
            else if(PlayerInfo[playerid][pMember] == 2) { SetSpawnInfo(playerid, 2, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 2; gTeam[playerid] = 2; }
            else if(PlayerInfo[playerid][pMember] == 3) { SetSpawnInfo(playerid, 2, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 2; gTeam[playerid] = 2; }
            else if(PlayerInfo[playerid][pMember] == 4) { SetSpawnInfo(playerid, 1, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 1; gTeam[playerid] = 1; }
            else if(PlayerInfo[playerid][pMember] == 5) { SetSpawnInfo(playerid, 5, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 5; gTeam[playerid] = 5; }
            else if(PlayerInfo[playerid][pMember] == 6) { SetSpawnInfo(playerid, 5, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 5; gTeam[playerid] = 5; }
            else if(PlayerInfo[playerid][pMember] == 7) { SetSpawnInfo(playerid, 2, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 2; gTeam[playerid] = 2; }
            else if(PlayerInfo[playerid][pMember] == 8) { SetSpawnInfo(playerid, 10, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 10; gTeam[playerid] = 10; }
            else if(PlayerInfo[playerid][pMember] == 9) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pMember] == 10) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pMember] == 11) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pMember] == 12) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pMember] == 13) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pMember] == 14) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pMember] == 15) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pMember] == 16) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pMember] == 17) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pMember] == 18) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pLeader] == 1) { SetSpawnInfo(playerid, 2, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 2; gTeam[playerid] = 2; }
            else if(PlayerInfo[playerid][pLeader] == 2) { SetSpawnInfo(playerid, 2, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 2; gTeam[playerid] = 2; }
            else if(PlayerInfo[playerid][pLeader] == 3) { SetSpawnInfo(playerid, 2, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 2; gTeam[playerid] = 2; }
            else if(PlayerInfo[playerid][pLeader] == 4) { SetSpawnInfo(playerid, 1, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 1; gTeam[playerid] = 1; }
            else if(PlayerInfo[playerid][pLeader] == 5) { SetSpawnInfo(playerid, 5, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 5; gTeam[playerid] = 5; }
            else if(PlayerInfo[playerid][pLeader] == 6) { SetSpawnInfo(playerid, 5, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 5; gTeam[playerid] = 5; }
            else if(PlayerInfo[playerid][pLeader] == 7) { SetSpawnInfo(playerid, 2, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 2; gTeam[playerid] = 2; }
            else if(PlayerInfo[playerid][pLeader] == 8) { SetSpawnInfo(playerid, 10, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 10; gTeam[playerid] = 10; }
            else if(PlayerInfo[playerid][pLeader] == 9) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pLeader] == 10) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pLeader] == 11) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pLeader] == 12) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pLeader] == 13) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pLeader] == 14) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pLeader] == 15) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pLeader] == 16) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pLeader] == 17) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            else if(PlayerInfo[playerid][pLeader] == 18) { SetSpawnInfo(playerid, 12, model,0.0,0.0,0.0,0,0,0,0,0,0,0); PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; }
            SpawnPlayer(playerid);
        }
    }
    if(PlayerInfo[playerid][pMember] > 0 || PlayerInfo[playerid][pLeader] > 0) { SetPlayerSkin(playerid, GetPVarInt(playerid, "Char")); }
    else { SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]); }
   
    if(!gPlayerAnimLibsPreloaded[playerid])
    {
        PreloadAnimLib(playerid,"BOMBER");
        PreloadAnimLib(playerid,"RAPPING");
        PreloadAnimLib(playerid,"SHOP");
        PreloadAnimLib(playerid,"BEACH");
        PreloadAnimLib(playerid,"SMOKING");
        PreloadAnimLib(playerid,"FOOD");
        PreloadAnimLib(playerid,"ON_LOOKERS");
        PreloadAnimLib(playerid,"DEALER");
        PreloadAnimLib(playerid,"CRACK");
        PreloadAnimLib(playerid,"CARRY");
        PreloadAnimLib(playerid,"COP_AMBIENT");
        PreloadAnimLib(playerid,"PARK");
        PreloadAnimLib(playerid,"INT_HOUSE");
        PreloadAnimLib(playerid,"FOOD");
        PreloadAnimLib(playerid,"PED");
        gPlayerAnimLibsPreloaded[playerid] = 1;
    }
    if(AntiSpawnKill[playerid] == false)
    {
        SetTimerEx("AntiSpawnKillTimer", 10000, 0, "i", playerid);
        AntiSpawnKill[playerid] = true;
        SetPlayerHealth(playerid, 999999.99);
        TextDrawShowForPlayer(playerid, AntiKill);
    }
    //
    SetPlayerWeapons(playerid);
    SetPlayerSpawn(playerid);
    SetPlayerToTeamColor(playerid);
    PlayerFixRadio(playerid);
    return 1;
}
__________________
Sorry for my bad english..

German Special Forces Reallife
Zunno is offline   Reply With Quote
Old 28/12/2011, 07:24 AM   #4
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,231
Reputation: 993
Default Re: OnPlayerRequestClass help

Quote:
Originally Posted by Zunno View Post
Hello,
I have a problem with my Script.
When i press F4 on my Server, i came on the ClassSelection, but when i press the Spawn Button
So SpawnPlayer isn't actually working under OnPlayerRequestClass. Try a timer of about 100 MS.
__________________
Click banner above for more info. View trailers here.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 28/12/2011, 07:28 AM   #5
Zunno
Big Clucker
 
Zunno's Avatar
 
Join Date: Dec 2009
Location: Germany
Posts: 49
Reputation: 7
Default Re: OnPlayerRequestClass help

Okay I'll try

/Edit: it doesn't work

my code now:
pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
    print("OnPlayerRequestClass called...");
    //SpawnPlayer(playerid);
    SetTimerEx("ZSpawn",100,0,"i",playerid);
    return 1;
}

public ZSpawn(playerid)
{
    return SpawnPlayer(playerid);
}

But even if I'm standing there, nothing inside, I'll post the press the spawn button again sent into the skin selection. Furthermore, I'll be right after I F4 in the skin selection, and not next to the dead.
__________________
Sorry for my bad english..

German Special Forces Reallife
Zunno is offline   Reply With Quote
Old 28/12/2011, 07:50 AM   #6
Ironboy
High-roller
 
Ironboy's Avatar
 
Join Date: Nov 2010
Location: Isle of Man
Posts: 1,933
Reputation: 429
Default Re: OnPlayerRequestClass help

The problem happent only when you press F4 for the class selection?
__________________
Ironboy is offline   Reply With Quote
Old 28/12/2011, 07:54 AM   #7
Zunno
Big Clucker
 
Zunno's Avatar
 
Join Date: Dec 2009
Location: Germany
Posts: 49
Reputation: 7
Default Re: OnPlayerRequestClass help

yes exactly.
I don't know why this is so.
__________________
Sorry for my bad english..

German Special Forces Reallife
Zunno is offline   Reply With Quote
Old 28/12/2011, 08:25 AM   #8
Ironboy
High-roller
 
Ironboy's Avatar
 
Join Date: Nov 2010
Location: Isle of Man
Posts: 1,933
Reputation: 429
Default Re: OnPlayerRequestClass help

I cant find anything from the script.
I suggest you to use ForceClassSelection
pawn Code:
if (strcmp("/class", cmdtext, true, 10) == 0)
    {
        ForceClassSelection(playerid);
        SendClientMessage(playerid, 0xAA3333AA,"[CLASS]> You have been forced to the class selection");
        SetPlayerHealth(playerid, 0.00);
        return 1;
        }
OR
pawn Code:
CMD:class(playerid,params[]){
    ForceClassSelection(playerid);
    SendClientMessage(playerid, 0xAA3333AA,"[CLASS]> You have been forced to the class selection");
    SetPlayerHealth(playerid, 0.00);
    return 1;}
__________________
Ironboy is offline   Reply With Quote
Old 28/12/2011, 08:29 AM   #9
AustinJ
Big Clucker
 
Join Date: Jul 2011
Posts: 145
Reputation: 15
Default Re: OnPlayerRequestClass help

One solution could be not use to use GF as a script.
__________________
AustinJ is offline   Reply With Quote
Old 28/12/2011, 08:29 AM   #10
Zunno
Big Clucker
 
Zunno's Avatar
 
Join Date: Dec 2009
Location: Germany
Posts: 49
Reputation: 7
Default Re: OnPlayerRequestClass help

Yes but, the problem is, if someone provided on F4 comes, he must make a relog out because he does not anymore from the skin selection.

Edit:
Yes but i work now 1 year on the script, and now even to start a self-made is quite time consuming if you have a running server
__________________
Sorry for my bad english..

German Special Forces Reallife
Zunno is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OnPlayerRequestClass -HELP- -BadGirl- Scripting Help 4 26/11/2011 07:06 PM
OnPlayerRequestClass Odyssey Help Archive 8 02/06/2011 12:47 PM
onplayerrequestclass fissekarl Help Archive 1 27/04/2011 05:07 PM
OnPlayerRequestClass help Devine Help Archive 4 07/11/2009 04:32 PM


All times are GMT. The time now is 11:48 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.