27.06.2012, 17:59
(
Последний раз редактировалось Gytis0; 27.06.2012 в 20:55.
)
People please. I really need help. The problem is, that a variable is always 0. That variable is "id".
Check this out, the current command:
You see these lines?
The variable "id" is always 0. I need the server to scroll through phone numbers and get the id of a player that has the phone number typed in and send the message to the player.
Check this out, the current command:
pawn Код:
if(strcmp("/sms", cmd, true) == 0)
{
if(PlayerInfo[playerid][pPhone] >= 1)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_WHITE,"Usage: /sms [number] [message]");
}
new id;
new gMessage[256];
new Message[256];
new pName[MAX_PLAYER_NAME+1];
new number;
number = PlayerInfo[playerid][pNr];
gMessage = strrest(cmdtext,idx);
if(!strlen(gMessage))
{
SendClientMessage(playerid,COLOR_WHITE,"Usage: /sms [number] [message]");
}
if(PlayerInfo[id][pNr] == strval(tmp))
{
GetPlayerName(playerid,pName,sizeof(pName));
format(Message,sizeof(Message),"%s(%d): %s",pName,number,gMessage);
SendClientMessage(id,COLOR_YELLOW,Message);
PlayerPlaySound(id,1085,0.0,0.0,0.0);
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You don't have a cellphone. Buy one at any 24/7 store.");
}
}
pawn Код:
new id;
//and
if(PlayerInfo[id][pNr] == strval(tmp))