lock command
#1

How to do if i didnt typed the target id the vehicle will be locked for everyone?

PHP код:
CMD:lock(playerid,params[])
{
  new 
name[24], str[77], TargetID;
  if(
sscanf(params"u",TargetID)) return SendClientMessage(playerid,Red,"Lock vehicle: /lock <id>");
  if(!
IsPlayerConnected(TargetID)) return SendClientMessage(playerid,Red,"Player is not connected");
  if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,Red,"You are not in vehicle");
  if(!
IsPlayerInAnyVehicle(TargetID)) return SendClientMessage(playerid,Red,"Player not in vehicle");
  {
    
GetPlayerName(TargetID,name,sizeof(name));
    
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),TargetID,0,1);
    
format(str,sizeof(str),"Vehicle: LOCKED FOR %s",name);
    
SendClientMessage(playerid,Red,str);
  }
  return 
1;

Reply
#2

pawn Код:
CMD:lock(playerid, params[])
{
    if(sscanf(params, "u", params[0])) return SendClientMessage(playerid,Red,"Lock vehicle: /lock <id>");
    if(!IsPlayerConnected(params[0])) return SendClientMessage(playerid,Red,"Player is not connected");
    if(!IsPlayerInAnyVehicle(params[0])) return SendClientMessage(playerid,Red,"Player not in vehicle");
   
    GetPlayerName(params[0], name,sizeof(name));
    format(str,sizeof(str),"Vehicle: LOCKED FOR %s", name);
    SendClientMessage(playerid, Red, str);
   
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(i != params[0])
            {
                SetVehicleParamsForPlayer(GetPlayerVehicleID(params[0]), i, 0, 1);
            }
        }
    }
    return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)