SA-MP Forums Archive
why this not work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: why this not work (/showthread.php?tid=162855)



why this not work - willsuckformoney - 25.07.2010

I cant get this up, its when a player spawns they need certain name to have the skin

pawn Код:
//==============================================================================
//==============================================================================
    new PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));

    if(GetPlayerSkin(playerid) == 294)
    {
        if(strcmp(PlayerName,"willsuckformoney",true))
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "Welcome back willsuckformoney");
        }
        else
        {
            SendClientMessage(playerid, COLOR_CRIMSON, "This is willsuckformoney SKIN ONLY!");
            ForceClassSelection(playerid);
        }
    }

    if(GetPlayerSkin(playerid) == 204)
    {
        if(strcmp(PlayerName,"Babul",true))
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "Welcome back Babul");
        }
        else
        {
            SendClientMessage(playerid, COLOR_CRIMSON, "This is Babul SKIN ONLY!");
            ForceClassSelection(playerid);
        }
    }

    if(GetPlayerSkin(playerid) == 123)
    {
        if(strcmp(PlayerName,"grandTheftOtto",true))
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "Welcome back grandTheftOtto");
        }
        else
        {
            SendClientMessage(playerid, COLOR_CRIMSON, "This is grandTheftOtto SKIN ONLY!");
            ForceClassSelection(playerid);
        }
    }
//==============================================================================
//==============================================================================
EDIT: This is under onplayerspawn ftw


Re: why this not work - Toni - 25.07.2010

use !strcmp as well, and what is the main problem? are they able to spawn?


Re: why this not work - willsuckformoney - 25.07.2010

yeah they spawn and they send messages, let me check the !strcmp now

EDIT: Tested ! it dont help


Re: why this not work - Toni - 25.07.2010

Oh!

Foolish me, I'm guessing the problem is that even if their name isn't that, they still spawn, try SetPlayerHealth(playerid, 0.0); above ForClassSelection(playerid);

(which means you kill them before actually forcing them).


Re: why this not work - willsuckformoney - 25.07.2010

lol figured that before you posted thanks for helps


Re: why this not work - VirSpectorX - 25.07.2010

It should be:
pawn Код:
//==============================================================================
//==============================================================================
    new PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));

    if(GetPlayerSkin(playerid) == 294)
    {
        if(!strcmp(PlayerName,"willsuckformoney",true))
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "Welcome back willsuckformoney");
        }
        else
        {
            SendClientMessage(playerid, COLOR_CRIMSON, "This is willsuckformoney SKIN ONLY!");
            ForceClassSelection(playerid);
        }
    }

    if(GetPlayerSkin(playerid) == 204)
    {
        if(!strcmp(PlayerName,"Babul",true))
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "Welcome back Babul");
        }
        else
        {
            SendClientMessage(playerid, COLOR_CRIMSON, "This is Babul SKIN ONLY!");
            ForceClassSelection(playerid);
        }
    }

    if(GetPlayerSkin(playerid) == 123)
    {
        if(!strcmp(PlayerName,"grandTheftOtto",true))
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "Welcome back grandTheftOtto");
        }
        else
        {
            SendClientMessage(playerid, COLOR_CRIMSON, "This is grandTheftOtto SKIN ONLY!");
            ForceClassSelection(playerid);
        }
    }
//==============================================================================
//==============================================================================
But, you did figure it out like that, right?


Re: why this not work - Victor - 25.07.2010

Код:
public OnPlayerRequestSpawn(playerid)
{
    new PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));

    if(GetPlayerSkin(playerid) == 294)
    {
        if(!strcmp(PlayerName,"willsuckformoney",true))
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "Welcome back willsuckformoney");
	    return 1;
        }
        else
        {
            SendClientMessage(playerid, COLOR_CRIMSON, "This is willsuckformoney SKIN ONLY!");
            return 0;
        }
    }

    if(GetPlayerSkin(playerid) == 204)
    {
        if(!strcmp(PlayerName,"Babul",true))
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "Welcome back Babul");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, COLOR_CRIMSON, "This is Babul SKIN ONLY!");
            return 0;
        }
    }

    if(GetPlayerSkin(playerid) == 123)
    {
        if(!strcmp(PlayerName,"grandTheftOtto",true))
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "Welcome back grandTheftOtto");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, COLOR_CRIMSON, "This is grandTheftOtto SKIN ONLY!");
            return 0;
        }
    }
    return 1;
}
Try putting that code under OnPlayerRequestSpawn

if they can't use the skin, They will not spawn and will go back to Class selection, if they can they will Spawn
return 1 = spawn
return 0 = no spawn
Hope that helped