SA-MP Forums Archive
Skin reset - 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)
+--- Thread: Skin reset (/showthread.php?tid=364026)



Skin reset - Stm - 29.07.2012

Hey im trying to make a /work command. So i have make the /work command, when i type it my the is changing. I have still have to make some commands but i have a problem. I want to make it when i type /work again to return the players skin and to go off duty.

Here what i have done for now:
Код:
new work;

public OnGameModeInit()
{
        work = CreatePickup(1239, 23, 317.130615, 692.398498, 11.460937);
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	if(pickupid == work)
	{
	    SendClientMessage(playerid, COLOR_YELLOW, "Type /work to start working!");
	}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp("/work",cmdtext))
	{
		GetPlayerSkin(playerid);
	    IsPlayerInRangeOfPoint(playerid, 7.0, 317.130615, 692.398498, 11.460937);
	    SetPlayerSkin(playerid, 277);
		return 1;
	}
	return 0;
}
I have still to add some commands and to add some SPECIAL_ACTIONS.


Re: Skin reset - Littlehelper - 29.07.2012

Use variables to detect that.
EX:
pawn Код:
new IsPlayerOnWork[MAX_PLAYERS];
// OnPlayerConnect
IsPlayerOnWork[playerid] = 0;
// OnDisconnect
IsPlayerOnWork[playerid] = 0;
// On Command /Work
if(!strcmp("/work",cmdtext))
    {
    if(IsPlayerOnWork[playerid] == 1)
    {
        IsPlayerOnWork[playerid] = 0;
        SendClientMessage(playerid,-1,"You Are Now Off Duty!");
        SetPlayerSkin(playerid, 277);
    else
    {
        IsPlayerOnWork[playerid] = 1;
        // More Code Of Yours
        return 1;
    }



Re: Skin reset - KingyKings - 29.07.2012

sorry i scripted wrong -.-

Make a [MAX_PLAYERS] to activate and disable it.


Re: Skin reset - Devilxz97 - 29.07.2012

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/work",cmdtext))
    {
        if(IsPlayerInRangeOfPoint(playerid, 7.0, 317.130615, 692.398498, 11.460937))
        {
            GetPlayerSkin(playerid);
            SetPlayerSkin(playerid, 277);
        }
        return 1;
    }
    return 1;
}
fix your cmd


Re: Skin reset - Stm - 29.07.2012

Littlehelper i get this when i type in your code:
Код:
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(143) : warning 217: loose indentation
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(143) : error 029: invalid expression, assumed zero
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(150) : warning 225: unreachable code
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(150) : warning 217: loose indentation
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(150) : error 029: invalid expression, assumed zero
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(150) : error 004: function "OnPlayerEnterVehicle" is not implemented
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(156) : warning 225: unreachable code
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(156) : error 029: invalid expression, assumed zero
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(156) : error 004: function "OnPlayerExitVehicle" is not implemented
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(162) : warning 225: unreachable code
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(162) : error 029: invalid expression, assumed zero
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(162) : error 004: function "OnPlayerStateChange" is not implemented
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(168) : warning 225: unreachable code
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(168) : error 029: invalid expression, assumed zero
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(168) : error 004: function "OnPlayerEnterCheckpoint" is not implemented
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(174) : warning 225: unreachable code
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(174) : error 029: invalid expression, assumed zero
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(174) : error 004: function "OnPlayerLeaveCheckpoint" is not implemented
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(180) : warning 225: unreachable code
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(180) : error 029: invalid expression, assumed zero
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(180) : error 004: function "OnPlayerEnterRaceCheckpoint" is not implemented
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(186) : warning 225: unreachable code
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(186) : error 029: invalid expression, assumed zero
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(186) : error 004: function "OnPlayerLeaveRaceCheckpoint" is not implemented
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(191) : warning 225: unreachable code
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(191) : error 029: invalid expression, assumed zero
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(191) : error 004: function "OnRconCommand" is not implemented
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(196) : warning 225: unreachable code
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(196) : error 029: invalid expression, assumed zero
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(196) : error 004: function "OnPlayerRequestSpawn" is not implemented
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(202) : warning 225: unreachable code
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(202) : error 029: invalid expression, assumed zero
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(202) : error 004: function "OnObjectMoved" is not implemented
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(208) : warning 225: unreachable code
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(208) : error 029: invalid expression, assumed zero
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(208) : error 004: function "OnPlayerObjectMoved" is not implemented
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(214) : warning 225: unreachable code
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(214) : error 029: invalid expression, assumed zero
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(214) : error 004: function "OnPlayerPickUpPickup" is not implemented
D:\servers\samp03e_svr_R2_win32\gamemodes\testing.pwn(216) : error 017: undefined symbol "pickupid"

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
KingyKings i have try your code everything is fine in pawn when compile it its ok but when i join my server i type /work on the end of the map and the commands work i have change my skin but when i type /work again i can`t return my skin back.


Re: Skin reset - Devilxz97 - 29.07.2012

pawn Код:
new IsPlayerOnWork[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    IsPlayerOnWork[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    IsPlayerOnWork[playerid] = 0;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        if(IsPlayerOnWork[playerid] == 1)
        {
            IsPlayerOnWork[playerid] = 0;
            SendClientMessage(playerid,-1,"You Are Now Off Duty!");
            SetPlayerSkin(playerid, 0);
        }
        else
        {
            IsPlayerOnWork[playerid] = 1;
            SendClientMessage(playerid,-1,"You Are Now On Duty!");
            SetPlayerSkin(playerid, 277);
        }
        return 1;
    }
    return 0;
}
try this


Re: Skin reset - Stm - 29.07.2012

Thanks Devilxz97 that work


Re: Skin reset - Littlehelper - 29.07.2012

Quote:
Originally Posted by Devilxz97
Посмотреть сообщение
pawn Код:
new IsPlayerOnWork[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    IsPlayerOnWork[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    IsPlayerOnWork[playerid] = 0;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        if(IsPlayerOnWork[playerid] == 1)
        {
            IsPlayerOnWork[playerid] = 0;
            SendClientMessage(playerid,-1,"You Are Now Off Duty!");
            SetPlayerSkin(playerid, 0);
        }
        else
        {
            IsPlayerOnWork[playerid] = 1;
            SendClientMessage(playerid,-1,"You Are Now On Duty!");
            SetPlayerSkin(playerid, 277);
        }
        return 1;
    }
    return 0;
}
try this
This is what i meant, instead i told you to do this in commented areas, you like getting spoon-feeded.


Re: Skin reset - Devilxz97 - 29.07.2012

Quote:
Originally Posted by Littlehelper[MDZ]
Посмотреть сообщение
This is what i meant, instead i told you to do this in commented areas, you like getting spoon-feeded.
yea , this is what Littlehelper tell u but u still didnt understand
until i create it with the Callback's

credits to little