onplayerrequestclass help
#1

I'm using ryders class maker and say i have this..

Код:
SetPlayerPos(playerid, 2482.113525, 1266.363037, 10.812500);
SetPlayerFacingAngle(playerid, 267.734191);
SetPlayerCameraLookAt(playerid, 2482.113525, 1266.363037, 10.812500);
SetPlayerCameraPos(playerid, 2482.113525 + (10 * floatsin(-267.734191, degrees)), 1266.363037 + (10 * floatcos(-267.734191, degrees)), 10.812500);
Is there a way i can make it so that class/es are restricted (say i want a faction and people to apply then a list of the member names that the script uses and lets them spawn) ?
Reply
#2

Can anyone help me with this??
Reply
#3

your gonna have to store player data, and make an extra option for faction
do a simple if statement to either show or hide that class selection
Reply
#4

how do i do this stuff?? i was hoping for something simple
Reply
#5

pawn Код:
new RestrictedSkin[MAX_PLAYERS];
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(classid == 1) //The restricted skin
    {
        RestrictedSkin[playerid] = 1;
    }
    if(classid == 2)
    {
        RestrictedSkin[playerid] = 0;
    }
}
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(RestrictedSkin[playerid] == 1)
    {
        SendClientMessage(playerid, 0xFF0000FF, "Restricted Skin!");
        return 0;
    }
    return 1;
}
Reply
#6

thanks! erm im still confused :/ where is the 1 i put skin id there or just leave it all how it is?? (srry i dont really know anything about coding)

is there really no way to just get the player name like some scripts do for restricted vehicles??
Reply
#7

The 1 is the classid, which means the number of skins you have added. Go look at your AddStaticClass's and see for eg:
pawn Код:
AddPlayerClass(170, 2138.6418,1286.0657,7.9422, 269.1425,5, 0, 22, 100, 32, 50);//This will be classid 1
AddPlayerClass(102, 1958.3783, 1343.1572, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50);//This will be classid 2
So for every classid you can make something show up when the player is going through the classes. If you want to have a text pop up at a class, for eg. that restricted class, then you do this:
pawn Код:
if(classid == 0)
{
    GameTextForPlayer(playerid,"~g~Restricted Skin",1000,5);
    RestrictedSkin[playerid] = 1;
}
EDIT: Sorry it's 5 am here. Change the 1 into 0 and 2 into 1, as coding digits start from 0.
Reply
#8

ok i kinda get it now what i dont get is how it knows who to let spawn and who to deny access?
Reply
#9

Well your just going to have to make a command to give him access.
pawn Код:
new AllowedPlayer[MAX_PLAYERIS];
Then, just change the earlier OnPlayerRequestSpawn to:
pawn Код:
public OnPlayerRequestSpawn(playerid)
{    
    if(RestrictedSkin[playerid] == 1 && AllowedPlayer[playerid] ==0)    
    {      
        SendClientMessage(playerid, 0xFF0000FF, "Restricted Skin!");        
        return 0;    
    }    
    return 1;
}
And give him access:
pawn Код:
new subjectid;
if(strcmp(string, "/giveaccess", true) == 0)
{
    string = strtok(cmdtext,idx);
    if(!strlen(string))
    {
        SendClientMessage(playerid, COLOR_GREY, "USAGE: /giveaccess [playerid/partofname]");
        return 1;  
    }
    subjectid = ReturnUser(string);
    SendClientMessage(playerid, 0xFFFFFFFF, "You have given access to the player");
    SendClientMessage(subjectid, 0xFFFFFFFF, "You have recieved VIP access");
    AllowedPlayer[subjectid] = 1;
}
Now you just save that the player is allowed in his user files so that you don't have to always redo it after he logs out.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)