SA-MP Forums Archive
Scripting help ! - 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: Scripting help ! (/showthread.php?tid=658201)



Scripting help ! - Jessica292John - 26.08.2018

Problem Solved.


Re: Scripting help ! - CodeStyle175 - 26.08.2018

delete the other shit, its just pointless code
PHP код:
GetUserName(pid){
    new 
s[24];
    
GetPlayerName(pid,s,24);
    return 
s;
}
GetUserInt(pid,s[]){
    return 
dini_Int(AddDirFile(dir_userfilesGetUserName(pid)), s);
}
CMD:oskin(pid){
    if(
GetUserInt(pid,"Roleplay")!=0)
        return 
SendClientMessage(playeridCOLOR_RED"Your gameplay state must be roleplay to use that command.");
    if (
GetPlayerWantedLevel(playerid) > 0
        return 
SendClientMessage(playeridCOLOR_RED"You are a wanted player!");
    new 
skin1=GetUserInt(pid,"skin1"),
        
skin2=GetUserInt(pid,"skin2"),
        
skin3=GetUserInt(pid,"skin3");
    return 
1;




Re: Scripting help ! - Jessica292John - 26.08.2018

Check the errors @CodeStyle175

https://ibb.co/gOFaDU


Re: Scripting help ! - Jessica292John - 26.08.2018

Please anyone help and make a code without errors !!


Re: Scripting help ! - CodeStyle175 - 26.08.2018

so you are very newbie to programming
PHP код:
GetUserName(pid){ 
    new 
s[24]; 
    
GetPlayerName(pid,s,24); 
    return 
s

GetUserInt(pid,s[]){ 
    return 
dini_Int(AddDirFile(dir_userfilesGetUserName(pid)), s); 


CMD:oskin(pid,p[]){ 
    if(
GetUserInt(pid,"Roleplay")!=0
        return 
SendClientMessage(pidCOLOR_RED"Your gameplay state must be roleplay to use that command."); 
    if (
GetPlayerWantedLevel(pid) > 0)  
        return 
SendClientMessage(pidCOLOR_RED"You are a wanted player!"); 
    new 
cnt=strval(p);
    if(
cnt || cnt 2)
        return 
SendClientMessage(pidCOLOR_RED"Variable must be between 0 to 2!");
    new 
s[10];
    
format(s,10,"skin%d",1+cnt);
    
SetPlayerSkin(pid,GetUserInt(pid,s));
    return 
1




Re: Scripting help ! - Jessica292John - 26.08.2018

It's not getting the skins.


Re: Scripting help ! - Jessica292John - 26.08.2018

Make it like this but instead /oskin many times to /oskin [1-3]
Exmaple: /oskin 3 to get "skin3" from org files

Код:
CMD:oskin(playerid, params[])
{
	new string[25], tmp[256], playername[MAX_PLAYER_NAME];
	new giveplayerid = GetPVarInt(playerid, "playerorg");
	GetPlayerName(playerid, playername, sizeof(playername));
	if (giveplayerid == 0) return SendClientMessage2(playerid, COLOR_RED, "Error: You aren't in an organization!");
	if(dini_Int(AddDirFile(dir_userfiles, playername), "Freeroam") == 1 && dini_Int(AddDirFile(dir_userfiles, playername), "Roleplay") == 0) return SendClientMessage(playerid, COLOR_RED, "Your gameplay state must be roleplay to use that command.");
	if ((IsALaw(playerid) || orgcata[giveplayerid-1] == 3) && GetPlayerWantedLevel(playerid) != 0) return SendClientMessage2(playerid, COLOR_RED, "You are a wanted player!");
	format(string, 10, "org%d", giveplayerid);
	new moneys1 = dini_Int(AddDirFile(dir_orgfiles, string), "skin1");
	if (moneys1 == 0) return SendClientMessage2(playerid, COLOR_SILVER, "Your organization doesn't have any skins yet.");
	if (GetPVarInt(playerid, "podfskin") != -1)
	{
		new temp1 = dini_Int(AddDirFile(dir_orgfiles, string), "skin2");
		if (GetPlayerSkin(playerid) == moneys1)
		{
			if (temp1 != 0)
			{
				SetPlayerSkinEx(playerid, temp1);
				SetPVarInt(playerid, "podfskin", temp1);
			}
		}
		else if (GetPlayerSkin(playerid) == temp1)
		{
			new temp2 = dini_Int(AddDirFile(dir_orgfiles, string), "skin3");
			if (temp2 != 0)
			{
				SetPlayerSkinEx(playerid, temp2);
				SetPVarInt(playerid, "podfskin", temp2);
			}
			else
			{
				SetPlayerSkinEx(playerid, moneys1);
				SetPVarInt(playerid, "podfskin", moneys1);
			}
		}
		else
		{
			SetPlayerSkinEx(playerid, moneys1);
			SetPVarInt(playerid, "podfskin", moneys1);
		}
	}
	else
	{
		SetPlayerSkinEx(playerid, moneys1);
		SetPVarInt(playerid, "podfskin", moneys1);
	}
	format(tmp, 12, "0x%sFF", dini_Get(AddDirFile(dir_orgfiles, string), "color"));
	SetPlayerColor(playerid, HexToInt(tmp));
	if (GetPVarInt(playerid, "playercolor") != -1) SetPVarInt(playerid, "playercolor", -1);
	SendClientMessage2(playerid, COLOR_WHITE, "ACTION: Switched organization skin.");
	if (IsALaw(playerid) || orgcata[GetPVarInt(playerid, "playerorg")-1] == 3 )
	{
		if(onduty[playerid] == 0)
		{
			SendClientMessage2(playerid, HexToInt(tmp), "You are now ON duty.");
			onduty[playerid] = 1;
		}
	}
	return 1;
}



Re: Scripting help ! - CodeStyle175 - 26.08.2018

i just showed the way you are not even trying you just found some pointless gamemode what can be put into recycle bin


Re: Scripting help ! - J0sh... - 27.08.2018

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
so you are very newbie to programming
you're a newbie to programming


Re: Scripting help ! - Sew_Sumi - 27.08.2018

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
so you are very newbie to programming
You're posting up non-working code, and making vast assumptions that the entire rest of thier code, doesn't do anything...




Are you actually intentionally trying to fuck their gamemode, then telling them they should put the script in the trash, because you seen ONE COMMAND.........


Seriously, you're completely psychic here?