Help with SrciptinG! - 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: Help with SrciptinG! (
/showthread.php?tid=587303)
Help with SrciptinG! -
Trollerz - 29.08.2015
I want to make it like when someone try to spawn with locked skin,i want it to display a message like "SKIN LOCKED"
PHP код:
public OnPlayerRequestClass(playerid, classid)
{
switch(classid)
{
case 0: Locked[playerid] = 0; //this one DOESNT.
case 1: Locked[playerid] = 0; //this one too
case 2: Locked[playerid] = 1; //this is going to be locked, right?
}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
if(Locked[playerid]) return 0;
{
SendClientMessage(playerid, COLOR_ORANGE, "DEAR USER,\nThis skin is password protected,If you have the password than you can just unlock by /unlock [PASSWORD HERE]");
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/unlock yolo"))
{
Locked[playerid] = 0;
SendClientMessage(playerid, COLOR_GREEN, "Skins unlocked!\nHurry you got the VIP skin");
new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname)); //It will work more accuratly
format(string, sizeof(string), "%s has just unlocked the vip skin!", pname);//%s = string :D, %i = integer, %d = decimal
SendClientMessageToAll(0xAAAAAAAA, string);
}
return 1;
}
Re: Help with SrciptinG! -
Logofero - 29.08.2015
PHP код:
#define MAX_SKINS (312) // ot 0 to 311
static bool:p_avalibleskins[MAX_PLAYERS][MAX_SKINS];
/*
* native SetPlayerSkinLock(playerid, skin, bool:togle=false);
* native IsPlayerSkinLocked(playerid, skin);
*/
#define SetPlayerSkinLock(%1,%2,%3) p_avalibleskins[%1][%2] = %3
#define IsPlayerSkinLocked(%1,%2) (!p_avalibleskins[%1][%2])
public OnPlayerRequestClass(playerid, classid)
{
if (IsPlayerSkinLocked(playerid, classid)) {
// SetPlayerSkin(playerid, classid + 1); // debug
SendClientMessage(playerid, COLOR_ORANGE, "This skin is locked for VIP");
}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
if(IsPlayerSkinLocked(playerid, GetPlayerSkin(playerid)))
{
SendClientMessage(playerid, COLOR_ORANGE, "DEAR USER,\nThis skin is password protected,If you have the password than you can just unlock by /unlock [PASSWORD HERE]");
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/unlock yolo"))
{
SetPlayerSkinLock(playerid, GetPlayerSkin(playerid), true); // Set unlock current skin
SendClientMessage(playerid, COLOR_GREEN, "Skins unlocked!\nHurry you got the VIP skin");
new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname)); //It will work more accuratly
format(string, sizeof(string), "%s has just unlocked the vip skin!", pname);//%s = string :D, %i = integer, %d = decimal
SendClientMessageToAll(0xAAAAAAAA, string);
}
return 1;
}
Re: Help with SrciptinG! -
Ahmad45123 - 29.08.2015
In the
PHP код:
public OnPlayerRequestSpawn(playerid)
{
if(Locked[playerid]) return 0;
{
SendClientMessage(playerid, COLOR_ORANGE, "DEAR USER,\nThis skin is password protected,If you have the password than you can just unlock by /unlock [PASSWORD HERE]");
}
return 1;
}
How do u return 0 and then open a bracket..
Change it to:
[php
public OnPlayerRequestSpawn(playerid)
{
if(Locked[playerid])
{
SendClientMessage(playerid, COLOR_ORANGE, "DEAR USER,\nThis skin is password protected,If you have the password than you can just unlock by /unlock [PASSWORD HERE]");
return 0;
}
return 1;
}
[/php]