Can someone here help fix my problem ?
#1

Hello, iam Angelo and iam new here,,,, i have a script but i dont know how to edit (i say before iam new in scripting). I want you help me for fix my problem. The problem is, in my script i have command to Rob Store (/robstore) but all new player can use that command. i Want the command only can use by they are which are have reach level to 7 or higher (level 6 or lower still cant use the command and if they use will be write "You must reach level 7 to rob a store"). So, can someone here help me to make a filterscript and fix this ?? Please help me Sorry for my bad English,,,
Reply
#2

You should put the code from /robstore in here

PHP код:
if(GetPlayerScore(playerid) >= 7//If the score of the players is 7 or higher
{
    
//The code for from /robstore should come here
}
else 
//if the score of the player is lower than 7
{
    
SendClientMessage(playerid0xFF0000FF"You have to be at least level 7 to use this command");

Show us the code for /robstore if you want more help.
Reply
#3

btw dude ^^ Where should i paste the code ? on Filterscript or ?? and before thanks for answer
Reply
#4

Post your command here
Reply
#5

Код:
CMD:robstore(playerid, params[])
{
	new playername[25], tmp[256], tmp2[256];
	new giveplayerid = GetPlayerInterior(playerid) != 0 ? adata[plastdoor[playerid]][atype] : 0;
	if (giveplayerid != ENTER_TYPE_SHOP) return SendClientMessage2(playerid, COLOR_RED, "Error: You are not in a store.");
	if (GetPlayerSkin(playerid) != pdfs[playerid] || GetPVarInt(playerid, "podfskin") != -1) return SendClientMessage2(playerid, COLOR_RED, "You are not in a civilian state (/civil).");
	GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
	new year, month, day;
	getdate(year, month, day);
	if (month < 10) year *= 10;
	if (day < 10) month *= 10;
	format(tmp, 9, "%d%d%d", year, month, day);
	new temp1 = strval(tmp);
	if (temp1 == dini_Int(AddDirFile(dir_userfiles, playername), "robbedstore")) return SendClientMessage2(playerid, COLOR_RED, "Your have already robbed a store today.");
	dini_IntSet(AddDirFile(dir_userfiles, playername), "robbedstore", temp1);
	temp1 = MRandom(25001)+5000;
	GivePlayerMoney(playerid, temp1);
	new moneys1 = GetPlayerWantedLevel(playerid);
	if (moneys1 < 4)
	{
		SetPlayerWantedLevel(playerid, 4);
		dini_IntSet(AddDirFile(dir_userfiles, playername), "Wanted", 4);
	}
	else if (moneys1 != 6)
	{
		SetPlayerWantedLevel(playerid, moneys1+1);
		dini_IntSet(AddDirFile(dir_userfiles, playername), "Wanted", moneys1+1);
	}
	new rand = MRandom(19)+3;
	for (new i = 0; i < PLAYERS; i++)
	{
		if (!IsPlayerConnected2(i) || GetPVarInt(i, "playerorg") == 0) continue;
		if (IsALaw(i) && GetPlayerWantedLevel(i) == 0) PlayCrimeReportForPlayer(i, playerid, rand);
	}
	format(tmp2, sizeof(tmp2), "~ %s has robbed the store in %s for $%d.", playername, zonenames[playerZone[playerid]][z_name], temp1);
	SendClientMessageToAll2(COLOR_SILVER, tmp2);
	dini_IntSet(AddDirFile(dir_userfiles, playername), "StoreRob", dini_Int(AddDirFile(dir_userfiles, playername), "StoreRob")+1);
	return 1;
}
Can u made the code can use by filterscript ? Thanks !
Reply
#6

PHP код:
CMD:robstore(playeridparams[])
{
    new 
playername[25], tmp[256], tmp2[256];
    new 
giveplayerid GetPlayerInterior(playerid) != adata[plastdoor[playerid]][atype] : 0;
    if (
playedtime[playerid][0] < 7) return SendClientMessage2(playeridCOLOR_RED"You can't use this command untill 7 score!");//score line
    
if (giveplayerid != ENTER_TYPE_SHOP) return SendClientMessage2(playeridCOLOR_RED"Error: You are not in a store.");
    if (
GetPlayerSkin(playerid) != pdfs[playerid] || GetPVarInt(playerid"podfskin") != -1) return SendClientMessage2(playeridCOLOR_RED"You are not in a civilian state (/civil).");
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    new 
yearmonthday;
    
getdate(yearmonthday);
    if (
month 10year *= 10;
    if (
day 10month *= 10;
    
format(tmp9"%d%d%d"yearmonthday);
    new 
temp1 strval(tmp);
    if (
temp1 == dini_Int(AddDirFile(dir_userfilesplayername), "robbedstore")) return SendClientMessage2(playeridCOLOR_RED"Your have already robbed a store today.");
    
dini_IntSet(AddDirFile(dir_userfilesplayername), "robbedstore"temp1);
    
temp1 MRandom(25001)+5000;
    
GivePlayerMoney(playeridtemp1);
    new 
moneys1 GetPlayerWantedLevel(playerid);
    if (
moneys1 4)
    {
        
SetPlayerWantedLevel(playerid4);
        
dini_IntSet(AddDirFile(dir_userfilesplayername), "Wanted"4);
    }
    else if (
moneys1 != 6)
    {
        
SetPlayerWantedLevel(playeridmoneys1+1);
        
dini_IntSet(AddDirFile(dir_userfilesplayername), "Wanted"moneys1+1);
    }
    new 
rand MRandom(19)+3;
    for (new 
0PLAYERSi++)
    {
        if (!
IsPlayerConnected2(i) || GetPVarInt(i"playerorg") == 0) continue;
        if (
IsALaw(i) && GetPlayerWantedLevel(i) == 0PlayCrimeReportForPlayer(iplayeridrand);
    }
    
format(tmp2sizeof(tmp2), "~ %s has robbed the store in %s for $%d."playernamezonenames[playerZone[playerid]][z_name], temp1);
    
SendClientMessageToAll2(COLOR_SILVERtmp2);
    
dini_IntSet(AddDirFile(dir_userfilesplayername), "StoreRob"dini_Int(AddDirFile(dir_userfilesplayername), "StoreRob")+1);
    return 
1;

Reply
#7

can i use it from filterscript ?
Reply
#8

Quote:
Originally Posted by AngeloBrand98
Посмотреть сообщение
can i use it from filterscript ?
Of course, you can.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)