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;
}
if(number == 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid phone number.");
if(number < 7 && > 10) return SendClientMessage(playerid, COLOR_GREY, "Numbers are between 7 and 10!");
if(number < 1000000 && > 1000000000) return SendClientMessage(playerid, COLOR_GREY, "Numbers are between 7 and 10!");
if(number < 1 && > 20) return SendClientMessage(playerid, COLOR_GREY, "Numbers are between 1 and 20!");
D:\SA-MP\Unlimited Gaming Roleplay\gamemodes\ugrp.pwn(9649) : error 029: invalid expression, assumed zero D:\SA-MP\Unlimited Gaming Roleplay\gamemodes\ugrp.pwn(9649) : warning 215: expression has no effect D:\SA-MP\Unlimited Gaming Roleplay\gamemodes\ugrp.pwn(9649) : error 001: expected token: ";", but found ")" D:\SA-MP\Unlimited Gaming Roleplay\gamemodes\ugrp.pwn(9649) : error 029: invalid expression, assumed zero D:\SA-MP\Unlimited Gaming Roleplay\gamemodes\ugrp.pwn(9649) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
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 < 1 && > 20) return SendClientMessage(playerid, COLOR_GREY, "Numbers are between 1 and 20!"); // This Line
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;
}
if(number < 1 && > 20) return SendClientMessage(playerid, COLOR_GREY, "Numbers are between 1 and 20!"); // This Line
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(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;
}
pawn Код:
|
basically, you removed the line, so how could it detect if they're buying less than 7 digit numbers or more than 10?
What I wanted was, I want, like, you need to buy phone number which has more than 7 digit numbers and less than 10, so they wont have nonrp numbers, like '1', '666', '1337', and stuffs. |
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 <= 6 || number >= 11) return SendClientMessage(playerid, COLOR_GREY, "The number should be more then 6 Characters and less then 11");
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;
}
pawn Код:
|
if(number <= 6 || number >= 11) return SendClientMessage(playerid, COLOR_GREY, "The number should be more then 6 Characters and less then 11");