16.07.2012, 07:45
Hello SAMP players,
I have some questions here, on how to change this command?
I have this command,
What I want is,
I want to disable from people buying less than 7 numbers or more than 10 numbers.
Is it even possible to do that?
Or all I need to do is changing this?
to
or
Hope to see a great reply, thanks.
Everyone who post an answer, will be added rep.
I have some questions here, on how to change this command?
I have this command,
pawn Код:
CMD:buysim(playerid, params[])
{
new string[128], number, File:file = fopen("cellphones.cfg", io_read);
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!PlayerInfo[playerid][pHasCellphone]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a cellphone yet.");
if(!IsPlayerInRangeOfPoint(playerid, 2, 1154.1257,-1180.9600,32.8187)) return SendClientMessage(playerid, COLOR_GREY, "You are not at the Telecom Company.");
if(sscanf(params, "i", number)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /buysim [desired number]");
if(number == 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid phone number.");
if(PlayerInfo[playerid][pCellphone] == number) return SendClientMessage(playerid, COLOR_GREY, "You already have this phone number.");
new idx = 1;
while(fread(file, string))
{
if(strval(string) == number) return SendClientMessage(playerid, COLOR_GREY, "This number is already registered.");
if(strval(string) == PlayerInfo[playerid][pCellphone])
{
fdeleteline("cellphones.cfg", idx);
}
idx ++;
}
fclose(file);
file = fopen("cellphones.cfg", io_append);
format(string, sizeof(string), "%d | %s\r\n", number, RPN(playerid));
fwrite(file, string);
fclose(file);
format(string, sizeof(string), "* %s has bought a new sim card.", RPN(playerid));
ProxDetector(15.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
if(!PlayerInfo[playerid][pCellphone])
{
SendClientMessage(playerid, COLOR_WHITE, " The company gave you the sim card for free as it's your first.");
SendClientMessage(playerid, COLOR_WHITE, " You can use /call and /sms now.");
}
else
{
GiveZaiatMoney(playerid, -500);
TaxMoney += 500;
SendClientMessage(playerid, COLOR_WHITE, " The company has charged you $500 for changing your sim card.");
}
PlayerInfo[playerid][pCellphone] = number;
return 1;
}
I want to disable from people buying less than 7 numbers or more than 10 numbers.
Is it even possible to do that?
Or all I need to do is changing this?
pawn Код:
if(number == 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid phone number.");
pawn Код:
if(number < 7 && > 10) return SendClientMessage(playerid, COLOR_GREY, "Numbers are between 7 and 10!");
pawn Код:
if(number < 1000000 && > 1000000000) return SendClientMessage(playerid, COLOR_GREY, "Numbers are between 7 and 10!");
Hope to see a great reply, thanks.
Everyone who post an answer, will be added rep.