21.04.2018, 09:09
Hi, I tried to duplicate /pm command as the /sms, but I want to eliminate playerid with "number"
Should my code look like this?
And how can I check if typed phone number exists (as pm's this player is offline)
PHP код:
CMD:sms(playerid,params[])
{
if(PlayerHasItem(playerid,"iPhone"))
{
new targetid,smsstring[257],string[128],str2[256];
if(sscanf(params,"us[257]", targetid, smsstring)) return SendClientMessage(playerid,-1,"*"COL_GREEN" /sms [number] [message]");
if(pInfo[playerid][pLogged] == 1)
{
if(pInfo[targetid][pPhone] == 0)
{
format(string,sizeof(string),"*"COL_PMRECEIVER" [SMS] %i: %s",pInfo[playerid][number],smsstring);
SendClientMessage(targetid,-1,string);
format(str2,sizeof(str2),"*"COL_PMSEND" [SMS] %i: %s",pInfo[targetid][number], smsstring);
SendClientMessage(playerid,-1,str2);
}
else {
SendClientMessage(playerid,-1,"*"COL_RED" This number has phone shut");
}
}
}
return 1;
}
PHP код:
CMD:sms(number,params[])
{
if(PlayerHasItem(playerid,"iPhone"))
{
new playerid, targetid,smsstring[257],string[128],str2[256];
if(sscanf(params,"us[257]", targetid, smsstring)) return SendClientMessage(playerid,-1,"*"COL_GREEN" /sms [number] [message]");
if(pInfo[playerid][pLogged] == 1)
{
if(pInfo[targetid][pPhone] == 0)
{
format(string,sizeof(string),"*"COL_PMRECEIVER" [SMS] %i: %s",pInfo[targetid][number],smsstring);
SendClientMessage(targetid,-1,string);
format(str2,sizeof(str2),"*"COL_PMSEND" [SMS] %i: %s",pInfo[playerid][number], smsstring);
SendClientMessage(playerid,-1,str2);
}
else {
SendClientMessage(playerid,-1,"*"COL_RED" This number has phone shut");
}
}
}
return 1;
}