SA-MP Forums Archive
need 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: need help (/showthread.php?tid=93102)



need help - soldierman - 23.08.2009

how would i turn that so only players in hunters ,barracks , and patriot can type /startconvoy
Код:
if (strcmp("/startconvoy", cmdtext, true, 10) == 0)
	{
		new playername[MAX_PLAYER_NAME], msg[128];
		GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
		format(msg, sizeof(msg), "%s wants to start a convoy type /joinconvoy if you want to join them ", playername);
		SendClientMessageToAll(COLOR_YELLOW,msg);
		return 1;
	}
if (strcmp("/joinvconvoy", cmdtext, true, 10) == 0)
    SendClientMessage(playerid,COLOR_YELLOW,"you have joined the convoy. Go to Sf carrier to join %s. "
	return 0;
}



Re: need help - ronyx69 - 23.08.2009

Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid))==433||GetVehicleModel(GetPlayerVehicleID(playerid))==432||GetVehicleModel(GetPlayerVehicleID(playerid))==425)



Re: need help - soldierman - 23.08.2009

where does that go ?



Re: need help - ronyx69 - 23.08.2009

Код:
if(strcmp("/startvconvoy", cmdtext, true, 10) == 0)
  {
  if(GetVehicleModel(GetPlayerVehicleID(playerid))==433||GetVehicleModel(GetPlayerVehicleID(playerid))==432||GetVehicleModel(GetPlayerVehicleID(playerid))==425)
    {
    new playername[MAX_PLAYER_NAME], msg[128];
	GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
	format(msg, sizeof(msg), "%s wants to start a convoy type /joinconvoy if you want to join them ", playername);
	SendClientMessageToAll(COLOR_YELLOW,msg);
	return 1;
    }
  else
    {
    SendClientMessage(playerid,COLOR_YELLOW,"You cannot start the convoy with this vehicle. "
    return 1;
    }
}



Re: need help - soldierman - 23.08.2009

thnks how would i test this ingame ?



Re: need help - Frankylez - 23.08.2009

Ronyx69, do you need so many calls of GetVehicleModel() and GetPlayerVehicleID(playerid)?

pawn Код:
if(!strcmp(cmdtext, "/startconvoy", true))
{
  new vehicle = GetVehicleModel(GetPlayerVehicleID(playerid));
  if(vehicle != 433 && vehicle != 432 && vehicle != 425)
  {
    SendClientMessage(playerid, COLOR_YELLOW, "You cannot start the convoy with this vehicle!");
    return true;
  }

  new PlayerName[MAX_PLAYER_NAME],
    msg[128];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  format(msg, sizeof(msg), "%s(%i) wants to start a convoy! Type /joinconvoy to join them!", PlayerName, playerid);
  SendClientMessageToAll(COLOR_YELLOW, msg);
  return true;
}
Please use my command which is more efficient than the one posted by you/Ronyx.
To test this ingame, compile this (press F5 in Pawno) and load the script on your server.


Re: need help - ronyx69 - 23.08.2009

I am always thinking about less lines, not less cells .. xD


Re: need help - [HUN]Gamestar - 23.08.2009

#define V(%1, %2) \
if( GetVeicleModel( GetPlayerVehicleID( %1 ) ) == %2 )


pawn Код:
if( ( V( playerid,433 ) || V( playerid, 432 ) || V( playerid, 425 ) ) )
{
  // Code
  }
  else
  {
    return SendClientMessage(playerid, COLOR_YELLOW, "You cannot start the convoy with this vehicle!");
  }
  return 1;
}
If player Vehicle model id equal hunters or barracks or patriot model id.

Gamestar


Re: need help - Frankylez - 23.08.2009

gamestar, won't that still call GetVehicleModel() and GetPlayerVehicleID() 3 times in that command?


Re: need help - FUNExtreme - 23.08.2009

Quote:
Originally Posted by Frankylez
gamestar, won't that still call GetVehicleModel() and GetPlayerVehicleID() 3 times in that command?
Yes. Just like yours