21.12.2012, 17:48
I want to know which one is the right one, i have used is, i even checked the sscanf integers and didn't manage to find the right one, the command is supposed to work as /setcontacts linenumber(ID) name(text) contact(anothertext), so contacts save like || 1st Contact : Johnny_Mann || 0-800-555-432 ||, can someone which is the right formula to make the command work ?
pawn Код:
CMD:setcontacts(playerid, params[])
{
new contact[128], name1[128], linenumber, description[128];
if(Cellphone[playerid] == 0) return SendClientMessage(playerid, GRAY, " You don't have a cellphone ! ");
if(sscanf(params, "is[128]", linenumber, name1, contact)) return SendClientMessage(playerid, GRAY, "Function : /setcontacts [ Line number ] [ Name ] [ Phonenumber ]");
if(1 < linenumber || linenumber > 7) return SendClientMessage(playerid, GRAY, "The available contacts are 1-7 ! ");
if(linenumber == 1)
{
strmid(PlayerData[playerid][pName1], name1, 0, strlen(params), 255);
strmid(PlayerData[playerid][pContact1], contact, 0, strlen(params), 255);
SendClientMessage(playerid, GRAY, " You've added a new contact to the list, containing the following information :");
format(description, sizeof(description), "|| 1st Contact : [ %s ] || [ %s ] ||", PlayerData[playerid][pName1], PlayerData[playerid][pContact1]);
SendClientMessage(playerid, GRAY, description);
PlayerData[playerid][pContact1s] = 1;
return 1;
}
if(linenumber == 2)
{
strmid(PlayerData[playerid][pName2], name1, 0, strlen(params), 255);
strmid(PlayerData[playerid][pContact2], contact, 0, strlen(params), 255);
SendClientMessage(playerid, GRAY, " You've added a new contact to the list, containing the following information :");
format(description, sizeof(description), "|| 2nd Contact : [ %s ] || [ %s ] ||", PlayerData[playerid][pName2], PlayerData[playerid][pContact2]);
SendClientMessage(playerid, GRAY, description);
PlayerData[playerid][pContact2s] = 1;
return 1;
}
if(linenumber == 3)
{
strmid(PlayerData[playerid][pName3], name1, 0, strlen(params), 255);
strmid(PlayerData[playerid][pContact3], contact, 0, strlen(params), 255);
SendClientMessage(playerid, GRAY, " You've added a new contact to the list, containing the following information :");
format(description, sizeof(description), "|| 3rd Contact : [ %s ] || [ %s ] ||", PlayerData[playerid][pName3], PlayerData[playerid][pContact3]);
SendClientMessage(playerid, GRAY, description);
PlayerData[playerid][pContact3s] = 1;
return 1;
}
if(linenumber == 4)
{
strmid(PlayerData[playerid][pName4], name1, 0, strlen(params), 255);
strmid(PlayerData[playerid][pContact4], contact, 0, strlen(params), 255);
SendClientMessage(playerid, GRAY, " You've added a new contact to the list, containing the following information :");
format(description, sizeof(description), "|| 4th Contact : [ %s ] || [ %s ] ||", PlayerData[playerid][pName4], PlayerData[playerid][pContact4]);
SendClientMessage(playerid, GRAY, description);
PlayerData[playerid][pContact4s] = 1;
return 1;
}
if(linenumber == 5)
{
strmid(PlayerData[playerid][pName5], name1, 0, strlen(params), 255);
strmid(PlayerData[playerid][pContact5], contact, 0, strlen(params), 255);
SendClientMessage(playerid, GRAY, " You've added a new contact to the list, containing the following information :");
format(description, sizeof(description), "|| 5th Contact : [ %s ] || [ %s ] ||", PlayerData[playerid][pName5], PlayerData[playerid][pContact5]);
SendClientMessage(playerid, GRAY, description);
PlayerData[playerid][pContact5s] = 1;
return 1;
}
if(linenumber == 6)
{
strmid(PlayerData[playerid][pName6], name1, 0, strlen(params), 255);
strmid(PlayerData[playerid][pContact6], contact, 0, strlen(params), 255);
SendClientMessage(playerid, GRAY, " You've added a new contact to the list, containing the following information :");
format(description, sizeof(description), "|| 6th Contact : [ %s ] || [ %s ] ||", PlayerData[playerid][pName6], PlayerData[playerid][pContact6]);
SendClientMessage(playerid, GRAY, description);
PlayerData[playerid][pContact6s] = 1;
return 1;
}
if(linenumber == 7)
{
strmid(PlayerData[playerid][pName7], name1, 0, strlen(params), 255);
strmid(PlayerData[playerid][pContact7], contact, 0, strlen(params), 255);
SendClientMessage(playerid, GRAY, " You've added a new contact to the list, containing the following information :");
format(description, sizeof(description), "|| 7th Contact : [ %s ] || [ %s ] ||", PlayerData[playerid][pName7], PlayerData[playerid][pContact7]);
SendClientMessage(playerid, GRAY, description);
PlayerData[playerid][pContact7s] = 1;
return 1;
}
return 1;
}