SA-MP Forums Archive
Need comand help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need comand help (/showthread.php?tid=328322)



Need comand help - dogy - 24.03.2012

Mod Wich I use is:larp
Comand Problems: /news--When I type /news say that I am not in the vehicle of cnn

this is script of komand:
Код:
if(strcmp(cmd, "/news", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9)
			{
		        if(PlayerInfo[playerid][pMuted] == 1)
				{
					SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
					return 1;
				}
				new counter = 0;
    			for(new i = 71; i <= 73; i++)
    			{
    			    new dist = CheckPlayerDistanceToVehicle(7, playerid, i);
    			    if(dist)
    			    {
    			        counter++;
    			    }
    			}
    			if(counter == 0)
    			{
					SendClientMessage(playerid, COLOR_GREY, "   You're not near/in your news van/chopper !");
					return 1;
    			}
    			else
    			{

					new length = strlen(cmdtext);
					while ((idx < length) && (cmdtext[idx] <= ' '))
					{
						idx++;
					}
					new offset = idx;
					new result[128];
					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: /news [newstext]");
						return 1;
					}
					new rtext[64];
					if(PlayerInfo[playerid][pRank] == 1) { rtext = "Intern Worker"; }
					else if(PlayerInfo[playerid][pRank] == 2) { rtext = "Journalist"; }
					else if(PlayerInfo[playerid][pRank] == 3) { rtext = "Head Journalist"; }
					else if(PlayerInfo[playerid][pRank] == 4) { rtext = "Company Secretary"; }
					else if(PlayerInfo[playerid][pRank] == 5) { rtext = "ABC Manager"; }
		    		else if(PlayerInfo[playerid][pRank] == 6) { rtext = "Network Producer"; }
					else { rtext = "Intern Worker"; }
					format(string, sizeof(string), "[ABC News] %s %s: %s", rtext, sendername, result);
					OOCNews(COLOR_NEWS,string);
					PlayerInfo[playerid][pNewsSkill] ++;
					if(PlayerInfo[playerid][pNewsSkill] == 50)
					{ SendClientMessage(playerid, COLOR_YELLOW, "* Your News Reporter Skill is now Level 2, soon you are able to Fly the News Chopper and talk Live."); }
					else if(PlayerInfo[playerid][pNewsSkill] == 100)
					{ SendClientMessage(playerid, COLOR_YELLOW, "* Your News Reporter Skill is now Level 3, soon you are able to Fly the News Chopper and talk Live."); }
					else if(PlayerInfo[playerid][pNewsSkill] == 200)
					{ SendClientMessage(playerid, COLOR_YELLOW, "* Your News Reporter Skill is now Level 4, you can fly the News Chopper now."); }
					else if(PlayerInfo[playerid][pNewsSkill] == 400)
					{ SendClientMessage(playerid, COLOR_YELLOW, "* Your News Reporter Skill is now Level 5, you can now talk Live with any person you want."); }
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   You are not a News Reporter !");
			}
		}//not connected
		return 1;
	}
This is my cnn cars:
Код:
forward IsACnnCar(carid);
new CnnCar[5];
else if(IsACnnCar (vehicleid))
	    {
		    format(string,sizeof(string),"Ulazite u %s (%d)  Vlasnik: Novinari",vehicle, vehicleid);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
		}
public IsACnnCar(carid) //cnn
{
	for(new i = 0; i < sizeof(CnnCar); i++)
	{
		if(carid == CnnCar[i])	return 1;
	}
	return 0;
}
//----------------------------novinari vozila----------------------------------------------------------------
	CnnCar[0] = AddStaticVehicleEx(582,1766.38439941,-1311.69238281,13.78235054,38.00000000,79,1,30000); //Newsvan
	CnnCar[1] = AddStaticVehicleEx(582,1760.66088867,-1312.13049316,13.78762722,38.00000000,79,1,30000); //Newsvan
	CnnCar[2] = AddStaticVehicleEx(582,1770.31567383,-1306.46459961,13.85975742,90.00000000,79,1,30000); //Newsvan
	CnnCar[3] = AddStaticVehicleEx(582,1770.42431641,-1301.53527832,13.83715153,90.00000000,79,1,30000); //Newsvan
	CnnCar[4] = AddStaticVehicleEx(582,1756.07971191,-1312.50219727,13.78856277,37.99621582,79,1,30000); //Newsvan
Pleas help me.Can someone make a command because I could not manage