cmd:call zcmd+sscanf
#1

Код:
//========================================[CMD /CALL]========================================================//
CMD:call(playerid,params[])
	{
	    new tmp[1024];
		new idx, string[256], sendername[MAX_PLAYER_NAME];

	    if(IsPlayerConnected(playerid))
		{
			tmp = strtok(params, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{00FF00}Folosire:{FFFFFF} /call [numar]");
				return 1;
			}
			if(PlayerInfo[playerid][pPnumber] == 0)
			{
				SendClientMessage(playerid, COLOR_GRAD2, "  Nu ai un telefon !");
				return 1;
			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "* %s scoate un telefon.", sendername);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			new phonenumb = strval(tmp);
			SetPlayerAttachedObject(playerid, 1, 330 , 6);
			SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
			if(phonenumb == 911)
			{
				SendClientMessage(playerid, COLOR_WHITE, "INDICIU: Foloseste tasta T pentru a vorbi la telefon, scrie /hangup pentru a inchide.");
				SendClientMessage(playerid, COLOR_ALLDEPT, "URGENTE: Ce departament cautati, Politia sau Fireman/Paramedic?");
				Mobile[playerid] = 911;
				return 1;
			}
			if(phonenumb == PlayerInfo[playerid][pPnumber])
			{
				SendClientMessage(playerid, COLOR_GRAD2, "  Numar ocupat!");
				Mobile[playerid] = 255;
				return 1;
			}
			if(Mobile[playerid] != 255)
			{
				SendClientMessage(playerid, COLOR_GRAD2, "  Deja esti intr-un apel..");
				return 1;
			}
			if(PlayerInfo[playerid][pMuted] >= 1)
			{
				SendClientMessage(playerid, TEAM_CYAN_COLOR, "Nu poti vorbi, ai mute!");
				return 1;
			}
			for(new i = 0; i < MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
					if(PlayerInfo[i][pPnumber] == phonenumb && phonenumb != 0)
					{
						playerid = i;
						Mobile[playerid] = playerid; //caller connecting
						if(IsPlayerConnected(playerid))
						{
						    if(playerid != INVALID_PLAYER_ID)
						    {
						        if(PhoneOnline[playerid] > 0)
						        {
						            SendClientMessage(playerid, COLOR_GREY, "   Acel jucator are telefonul inchis !");
						            return 1;
						        }
								if (Mobile[playerid] == 255)
								{
                                    if(IsAtPublicPhone(playerid)) TogglePlayerControllable(playerid, 0);

									if(PlayerInfo[playerid][pDonateRank] == 1) { format(string, sizeof(string), "Telefonul tau suna - Apelant: %s", sendername); }
									else format(string, sizeof(string), "Telefonul tau suna.");
									SendClientMessage(playerid, COLOR_YELLOW, string);
									GetPlayerName(playerid, sendername, sizeof(sendername));
									RingTone[playerid] = 10;
									format(string, sizeof(string), "* Telefonul lui %s incepe sa sune.", sendername);
									//SendClientMessage(playerid, COLOR_WHITE, "HINT: You now use T to talk on your cellphone, type /hangup to hang up");
									ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
									CellTime[playerid] = 1;
									return 1;
								}
							}
						}
					}
				}
			}
			SendClientMessage(playerid, COLOR_GRAD2, "  Numar ocupat!");
            SetPlayerSpecialAction(playerid,SPECIAL_ACTION_STOPUSECELLPHONE);
			RemovePlayerAttachedObject(playerid, 1);
		}
		return 1;
 }
How to make/call's zcmd command + sscanf shortening of it's best friends
Reply


Messages In This Thread
cmd:call zcmd+sscanf - by Jimmi - 29.07.2015, 09:38
Re: cmd:call zcmd+sscanf - by SpikY_ - 29.07.2015, 10:02
Re : cmd:call zcmd+sscanf - by Dutheil - 29.07.2015, 11:05

Forum Jump:


Users browsing this thread: 2 Guest(s)