SA-MP Forums Archive
How can I fix it ?? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: How can I fix it ?? (/showthread.php?tid=370021)



How can I fix it ?? - x96664 - 18.08.2012

Hi, I have a little problem I've liked to have classes in my server which are only for admins and I did this:
pawn Код:
public OnGameModeInit()
{
//I won't link all classes they're about 100
    AddPlayerClass(0,-344.9633,1526.4976,75.3570,181.0746,0,0,0,0,0,0);
    AddPlayerClass(299,-344.9633,1526.4976,75.3570,181.0746,0,0,0,0,0,0);
    return 1;
}
public OnPlayerRequestSpawn(playerid)
{
    SendClientMessage(playerid,-1,"-----------------------------------------------------");
    SendClientMessage(playerid,-1,"Have fun!");
    SendClientMessage(playerid,-1,"-----------------------------------------------------");
    new playerskin = GetPlayerSkin(playerid);
    if(playerskin == 299) {
    if(!IsPlayerAdmin(playerid))//If I put after (playerid)) return SendClientMessage it just sends the message and allows the player to spawn himself
    return 0;
    }
So I want to use a message for player when he try to spawn with admin skin but If I use return SendClientMessage it just ignores return 0; , If I remove "return SendClientMessage" and I press spawn it sends the 3 messages:
pawn Код:
SendClientMessage(playerid,-1,"-----------------------------------------------------");
    SendClientMessage(playerid,-1,"Have fun!");
    SendClientMessage(playerid,-1,"-----------------------------------------------------");
and I cannot spawn with that skin if I don't login as an admin.
Can somebody help me to make when player click spawn to be unable to spawn and receive warning message if he is not an admin and not to receive the spawn messages(if I put them at OnPlayerSpawn lines players are receiving them on every spawn if they got killed or something else happens).


Re: How can I fix it ?? - Tom1412 - 19.08.2012

I think this should do what your wanting.

pawn Код:
public OnGameModeInit()
{
//I won't link all classes they're about 100
    AddPlayerClass(0,-344.9633,1526.4976,75.3570,181.0746,0,0,0,0,0,0);
    AddPlayerClass(299,-344.9633,1526.4976,75.3570,181.0746,0,0,0,0,0,0);
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    if(!IsPlayerAdmin(playerid))
    {
        SendClientMessage(playerid,-1,"-----------------------------------------------------");
        SendClientMessage(playerid,-1,"Have fun!");
        SendClientMessage(playerid,-1,"-----------------------------------------------------");
     //Now the admin and normal player will spawn differently
    }
    else
    {
        SendClientMessage(playerid,-1,"non admin");
    }
    return 1;
}



Re: How can I fix it ?? - x96664 - 19.08.2012

Quote:
Originally Posted by Tom1412
Посмотреть сообщение
I think this should do what your wanting.

pawn Код:
public OnGameModeInit()
{
//I won't link all classes they're about 100
    AddPlayerClass(0,-344.9633,1526.4976,75.3570,181.0746,0,0,0,0,0,0);
    AddPlayerClass(299,-344.9633,1526.4976,75.3570,181.0746,0,0,0,0,0,0);
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    if(!IsPlayerAdmin(playerid))
    {
        SendClientMessage(playerid,-1,"-----------------------------------------------------");
        SendClientMessage(playerid,-1,"Have fun!");
        SendClientMessage(playerid,-1,"-----------------------------------------------------");
     //Now the admin and normal player will spawn differently
    }
    else
    {
        SendClientMessage(playerid,-1,"non admin");
    }
    return 1;
}
Ok, but what about the certain skins which I like to be only for admins and the message ?


Re: How can I fix it ?? - [MK]Man_Deep - 19.08.2012

Quote:
Originally Posted by x96664
Посмотреть сообщение
Hi, I have a little problem I've liked to have classes in my server which are only for admins and I did this:
pawn Код:
public OnGameModeInit()
{
//I won't link all classes they're about 100
    AddPlayerClass(0,-344.9633,1526.4976,75.3570,181.0746,0,0,0,0,0,0);
    AddPlayerClass(299,-344.9633,1526.4976,75.3570,181.0746,0,0,0,0,0,0);
    return 1;
}
public OnPlayerRequestSpawn(playerid)
{
    SendClientMessage(playerid,-1,"-----------------------------------------------------");
    SendClientMessage(playerid,-1,"Have fun!");
    SendClientMessage(playerid,-1,"-----------------------------------------------------");
    new playerskin = GetPlayerSkin(playerid);
    if(playerskin == 299) {
    if(!IsPlayerAdmin(playerid))//If I put after (playerid)) return SendClientMessage it just sends the message and allows the player to spawn himself
    return 0;
    }
So I want to use a message for player when he try to spawn with admin skin but If I use return SendClientMessage it just ignores return 0; , If I remove "return SendClientMessage" and I press spawn it sends the 3 messages:
pawn Код:
SendClientMessage(playerid,-1,"-----------------------------------------------------");
    SendClientMessage(playerid,-1,"Have fun!");
    SendClientMessage(playerid,-1,"-----------------------------------------------------");
and I cannot spawn with that skin if I don't login as an admin.
Can somebody help me to make when player click spawn to be unable to spawn and receive warning message if he is not an admin and not to receive the spawn messages(if I put them at OnPlayerSpawn lines players are receiving them on every spawn if they got killed or something else happens).
Try a New GameMode that should help [Glow][/Glow]