20.01.2012, 10:49
I hate this kind of layout :/ It's so easy to lose your bearings in it. Try this one instead, I restructured it.
pawn Код:
CMD:sms(playerid, params[])
{
if(PlayerInfo[playerid][Phone] != phone_yes)
return SendClientMessage(playerid, COLOR_GREY, "You don't have a phone!");
if(phoneon[playerid] == false)
return SendClientMessage(playerid, COLOR_GREY, "You have your phone turned off!");
new
text[128], //<----- NIET VERGETEN OM STRING SIZE TO DOEN VOOR EEN TEXT OF %S INPUT!!!
pnumber;
if(sscanf(params, "is[128]", pnumber, text)) //String size for text.. NIET VERGETEN ANDERS CRASHED ALLES
return SendClientMessage(playerid, COLOR_GREY, "USAGE: /sms [Phone Number] [SMS text]");
if(PlayerInfo[playerid][PhoneNumber] == pnumber)
return SendClientMessage(playerid, COLOR_GREY, "You cannot send a message to yourself!");
foreach(Player, i)
{
if(PlayerInfo[i][Phone] != phone_yes)
continue;
if(PlayerInfo[i][PhoneNumber] != pnumber)
continue;
if(!phoneon[i])
return SendClientMessage(playerid, COLOR_GREY, "This player has his/her phone turned off!");
new string[144];
format(string, sizeof(string), "[SMS]%i: %s.", PlayerInfo[playerid][PhoneNumber], text);
SendClientMessage(i, TEAM_RADIO_COLOR, string);
format(string, sizeof(string), "You just sent a text message to %i", pnumber);
SendClientMessage(playerid, TEAM_RADIO_COLOR, string);
PlayerPlaySound(i,1085,0.0,0.0,0.0);
return 1;
}
SendClientMessage(playerid, COLOR_GREY, "No such number!");
return 1;
}