/sms command bugged
#1

Quote:

if(strcmp(cmd, "/sms", true) == 0)
{
if(gPlayerLogged[playerid] != 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /sms [phonenumber]");
SendClientMessage(playerid, COLOR_GREY, "USAGE: /sms 411 (for a list for short numbers)");
return 1;
}
new phonenumb = strval(tmp);
if(phonenumb == 311)
{
if(PlayerInfo[playerid][pJob] == 0)
{
tmp = strtok(cmdtext, idx);
if( !strcmp( tmp, "", true ) )
{
SendClientMessage(playerid, COLOR_PINK, "[ ! ] [SMS] Great, I have a job for you! Come to the job house.");
SendClientMessage(playerid, COLOR_WHITE, "[ ! ] [HINT] Follow the red maker to the job house!");
SetPlayerCheckpoint(playerid, 2352.0979,-1167.8988,27.7965, 3.0);
}
if( !strcmp( tmp, "mechanic", true ) )
{
SendClientMessage(playerid, COLOR_PINK, "[ ! ] [SMS] Great, you have been accepted into your choosen job!");
SendClientMessage(playerid, COLOR_WHITE, "[ ! ] [HINT] Follow the red maker to your new job!");
}
}
else if(PlayerInfo[playerid][pJob] != 0)
{
SendClientMessage(playerid, COLOR_PINK, "[ ! ] [SMS] Sorry , you already have a job!");
}
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "[ ! ] You are not logged in!");
return 0;
}
}

But when i type /sms 311 it shows both when i type in /sms 311 mechanic it just shows mechanic.
Reply
#2

May I ask why ou posted this in SA:MP 0.3 scripting? Cause this seems like 0.2X script
Reply
#3

maybe hes converting it to 0.3?
tip: else if.
Reply
#4

Quote:
Originally Posted by TMasters
May I ask why ou posted this in SA:MP 0.3 scripting? Cause this seems like 0.2X script
Huh? Don't say things you don't know about, 0.3 has nothing with 0.2X in scripting (than new functions).

Ask in the Godfather thread or where ever you downloaded this from.
Reply
#5

Quote:
Originally Posted by MenaceX^
Quote:
Originally Posted by TMasters
May I ask why ou posted this in SA:MP 0.3 scripting? Cause this seems like 0.2X script
Huh? Don't say things you don't know about, 0.3 has nothing with 0.2X in scripting (than new functions).

Ask in the Godfather thread or where ever you downloaded this from.
Yea, i downloaded this from my head.

Quote:
Originally Posted by GrayExodus
maybe hes converting it to 0.3?
tip: else if.
No , i am just coding it on 0.3 why bother with 0.2x anymore...
Reply
#6

Here is command..works
Код:
if(strcmp(cmd, "/txt", true) == 0 || strcmp(cmd, "/t", true) == 0 || strcmp(cmd, "/sms", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
		{
		  if(gPlayerLogged[playerid] == 0)
	    {
	      SendClientMessage(playerid, COLOR_GREY, "  You havent logged in yet!");
	      return 1;
	    }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/t)ext [phonenumber] [text chat]");
				return 1;
			}
			if(PlayerInfo[playerid][pPnumber] == 0)
			{
				SendClientMessage(playerid, COLOR_GRAD2, " You don't have a cell phone...");
				return 1;
			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "* %s takes out a cellphone.", sendername);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			new phonenumb = strval(tmp);
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/t)ext [phonenumber] [text chat]");
				return 1;
			}
			if(phonenumb == 555)
			{
				if ((strcmp("yes", result, true, strlen(result)) == 0) && (strlen(result) == strlen("yes")))
				{
					SendClientMessage(playerid, COLOR_WHITE, "Text Message Delivered.");
					if (gTeam[playerid] == 2 || gTeam[playerid] == 1)
					{
						SendClientMessage(playerid, COLOR_YELLOW, "SMS: I have no idea what you're talking about, Sender: MOLE (555)");
						RingTone[playerid] = 20;
						return 1;
					}
					return 1;
				}
				else
				{
					SendClientMessage(playerid, COLOR_YELLOW, "SMS: A simple Yes will do, Sender: MOLE (555)");
					RingTone[playerid] = 20;
					return 1;
				}
			}
			for(new i = 0; i < MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
					if(PlayerInfo[i][pPnumber] == phonenumb && phonenumb != 0)
					{
						giveplayerid = i;
						Mobile[playerid] = giveplayerid; //caller connecting
						if(IsPlayerConnected(giveplayerid))
						{
						  if(giveplayerid != INVALID_PLAYER_ID)
						  {
						    if(PhoneOnline[giveplayerid] > 0)
						    {
						      SendClientMessage(playerid, COLOR_GREY, "  That players Phone is Offline!");
						      return 1;
						    }
								format(string, sizeof(string), "SMS: %s, Sender: %s (%d)", result,sendername,PlayerInfo[playerid][pPnumber]);
								GetPlayerName(giveplayerid, sendername, sizeof(sendername));
								//format(string, sizeof(string), "* %s's phone beeps.", sendername);
								RingTone[giveplayerid] =20;
								SendClientMessage(playerid, COLOR_WHITE, "Text Message Delivered");
								SendClientMessage(giveplayerid, COLOR_YELLOW, string);
								SendClientMessage(playerid, COLOR_YELLOW, string);
								format(string, sizeof(string), "~r~$-%d", txtcost);
								GameTextForPlayer(playerid, string, 5000, 1);
								SafeGivePlayerMoney(playerid,-txtcost);
								SBizzInfo[2][sbTill] += txtcost;
								ExtortionSBiz(2, txtcost);
					      	PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
					      	Mobile[playerid] = 255;
								return 1;
							}
						}
					}
				}
			}
			SendClientMessage(playerid, COLOR_GRAD2, " Message Delivery Failed...");
		}
		return 1;
	}
Reply
#7

Another WS copy ^^ !

Just remove the tmp = Str...(cmdtext,idx)

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)