SA-MP Forums Archive
One question about PlayerSkin - 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: One question about PlayerSkin (/showthread.php?tid=446208)



One question about PlayerSkin - 5002 - 24.06.2013

i have one duty menu
LSPD biker
LSPD 1
LSPD 2

Off Duty

when player choose off duty her Duty guns cleared and her guns and skin restored to him after choose off duty

whats your offer?


Re: One question about PlayerSkin - 5002 - 25.06.2013

i need make a saving script before it?


Re: One question about PlayerSkin - Jstylezzz - 25.06.2013

What do you want exactly?


Re: One question about PlayerSkin - 5002 - 25.06.2013

for example now i have balas skin and one m4

and move to duty and recive police skin and police guns(baton-eagle-spray)
after end dity i move and choose Offduty from my dialog

now i want when player choose off duty from menu her last skin and guns restore to him


Re: One question about PlayerSkin - introzen - 25.06.2013

You need to store the weapons into an array.

pawn Код:
new OffdutyWeapon[MAX_PLAYERS][13][2];
Where [13] is the maximum number of weapon slots you have.
and [2] is the ammo for the weapons.

So under your On-duty menu, add something like this:

pawn Код:
for (new i = 0; i < 13; i++)
{
    GetPlayerWeaponData(playerid, i, OffdutyWeapon[i][0], OffdutyWeapon[i][1]);
}
new skin = GetPlayerSkin(playerid);
OffdutySkin[playerid] = skin;
And on the offduty menu, add something like this:

pawn Код:
ResetPlayerWeapons(playerid);
for (new i = 0; i < 13; i++)
{
    GivePlayerWeapon(playerid, OffdutyWeapon[i][0], OffdutyWeapon[i][1]);
}
SetPlayerSkin(playerid,OffdutySkin[playerid]);



Re: One question about PlayerSkin - 5002 - 25.06.2013

my command is
Код:
if(!strcmp(cmdtext,"/duty",true))
	{
	if(IsPlayerInRangeOfPoint(playerid, 6.0, 233.19999, 125.5, 1003.200012207))
	{
	TogglePlayerControllable(playerid,0);
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, ""YELLOW"Choose Skin","1.LSPD Biker Cop\n.2LSPD 2\n.3LSPD 3\n.4Off Duty","Choose","exit");
	}
	else SendClientMessage(playerid,-1,"You must be in "GREEN"LSPD"YELLOW" Looker"WHITE" room");
	return 1;

and my dialog
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
if(response)
{
TogglePlayerControllable(playerid,1);
}
switch(listitem)
{
case 0:
{
SetPlayerSkin(playerid,284);
TogglePlayerControllable(playerid,1);
GivePlayerWeapon(playerid,24,400);
GivePlayerWeapon(playerid,3,400);
GivePlayerWeapon(playerid,41,400);
SendClientMessage(playerid,-1,"You are on duty");

return 1;
}
case 1:
{
SetPlayerSkin(playerid,283);
TogglePlayerControllable(playerid,1);
GivePlayerWeapon(playerid,24,400);
GivePlayerWeapon(playerid,3,400);
GivePlayerWeapon(playerid,41,400);
SendClientMessage(playerid,-1,"You are on duty");
return 1;
}
case 2:
{
SetPlayerSkin(playerid,282);
TogglePlayerControllable(playerid,1);
GivePlayerWeapon(playerid,24,400);
GivePlayerWeapon(playerid,3,400);
GivePlayerWeapon(playerid,41,400);
SendClientMessage(playerid,-1,"You are on duty");
return 1;
}
case 3:
{
SetPlayerSkin(playerid,0);
SendClientMessage(playerid,-1,"Keep a good citizen");
ResetPlayerWeapons(playerid);
return 1;
}
}
}
return 1;
}
i think my script isnt normal cause im new scripter and very amatour
can tell me what i must do with my code?


Re: One question about PlayerSkin - introzen - 25.06.2013

Update your dialog code to this:

pawn Код:
new OffdutyWeapon[MAX_PLAYERS][13][2];
new OffdutySkin[MAX_PLAYERS];
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
if(response)
{
TogglePlayerControllable(playerid,1);
}
switch(listitem)
{
case 0:
{
for (new i = 0; i < 13; i++)
{
    GetPlayerWeaponData(playerid, i, OffdutyWeapon[i][0], OffdutyWeapon[i][1]);
}
new skin = GetPlayerSkin(playerid);
OffdutySkin[playerid] = skin;
SetPlayerSkin(playerid,284);
TogglePlayerControllable(playerid,1);
GivePlayerWeapon(playerid,24,400);
GivePlayerWeapon(playerid,3,400);
GivePlayerWeapon(playerid,41,400);
SendClientMessage(playerid,-1,"You are on duty");
return 1;
}
case 1:
{
for (new i = 0; i < 13; i++)
{
    GetPlayerWeaponData(playerid, i, OffdutyWeapon[i][0], OffdutyWeapon[i][1]);
}
new skin = GetPlayerSkin(playerid);
OffdutySkin[playerid] = skin;
SetPlayerSkin(playerid,283);
TogglePlayerControllable(playerid,1);
GivePlayerWeapon(playerid,24,400);
GivePlayerWeapon(playerid,3,400);
GivePlayerWeapon(playerid,41,400);
SendClientMessage(playerid,-1,"You are on duty");
return 1;
}
case 2:
{
for (new i = 0; i < 13; i++)
{
    GetPlayerWeaponData(playerid, i, OffdutyWeapon[i][0], OffdutyWeapon[i][1]);
}
new skin = GetPlayerSkin(playerid);
OffdutySkin[playerid] = skin;
SetPlayerSkin(playerid,282);
TogglePlayerControllable(playerid,1);
GivePlayerWeapon(playerid,24,400);
GivePlayerWeapon(playerid,3,400);
GivePlayerWeapon(playerid,41,400);
SendClientMessage(playerid,-1,"You are on duty");
return 1;
}
case 3:
{
ResetPlayerWeapons(playerid);
for (new i = 0; i < 13; i++)
{
    GivePlayerWeapon(playerid, OffdutyWeapon[i][0], OffdutyWeapon[i][1]);
}
SetPlayerSkin(playerid,OffdutySkin[playerid]);
SendClientMessage(playerid,-1,"Keep a good citizen");
return 1;
}
}
}
return 1;
}
Let me know if it works.


Re: One question about PlayerSkin - 5002 - 25.06.2013

errors of your offer

Код:
F:\GTA San Andreas\111\0.3x\filterscripts\1.pwn(533) : error 035: argument type mismatch (argument 3)
F:\GTA San Andreas\111\0.3x\filterscripts\1.pwn(549) : error 035: argument type mismatch (argument 3)
F:\GTA San Andreas\111\0.3x\filterscripts\1.pwn(565) : error 035: argument type mismatch (argument 3)
F:\GTA San Andreas\111\0.3x\filterscripts\1.pwn(582) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: One question about PlayerSkin - introzen - 25.06.2013

mark the lines please


Re: One question about PlayerSkin - 5002 - 25.06.2013

Код:
GetPlayerWeaponData(playerid, i, OffdutyWeapon[i][0], OffdutyWeapon[i][1]);  its line[533]
GetPlayerWeaponData(playerid, i, OffdutyWeapon[i][0], OffdutyWeapon[i][1]);  its line[549]
GetPlayerWeaponData(playerid, i, OffdutyWeapon[i][0], OffdutyWeapon[i][1]);  its line[565]
GivePlayerWeapon(playerid, OffdutyWeapon[i][0], OffdutyWeapon[i][1]); its line [582]