need help
#1

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;
}
Reply
#2

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

where does that go ?
Reply
#4

Код:
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;
    }
}
Reply
#5

thnks how would i test this ingame ?
Reply
#6

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.
Reply
#7

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

#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
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)