Can someone here help fix my problem ? -
AngeloBrand98 - 06.11.2016
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,,,
Re: Can someone here help fix my problem ? -
PeanutButter - 06.11.2016
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(playerid, 0xFF0000FF, "You have to be at least level 7 to use this command");
}
Show us the code for /robstore if you want more help.
Re: Can someone here help fix my problem ? -
AngeloBrand98 - 07.11.2016
btw dude ^^ Where should i paste the code ? on Filterscript or ?? and before thanks for answer
Re: Can someone here help fix my problem ? -
Pearson - 07.11.2016
Post your command here
Re: Can someone here help fix my problem ? -
AngeloBrand98 - 07.11.2016
Код:
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 !
Re: Can someone here help fix my problem ? -
IceBilizard - 07.11.2016
PHP код:
CMD:robstore(playerid, params[])
{
new playername[25], tmp[256], tmp2[256];
new giveplayerid = GetPlayerInterior(playerid) != 0 ? adata[plastdoor[playerid]][atype] : 0;
if (playedtime[playerid][0] < 7) return SendClientMessage2(playerid, COLOR_RED, "You can't use this command untill 7 score!");//score line
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;
}
Re: Can someone here help fix my problem ? -
AngeloBrand98 - 07.11.2016
can i use it from filterscript ?
Re: Can someone here help fix my problem ? - justice96 - 07.11.2016
Quote:
Originally Posted by AngeloBrand98
can i use it from filterscript ?
|
Of course, you can.